summaryrefslogtreecommitdiff
path: root/TelepathyQt
diff options
context:
space:
mode:
Diffstat (limited to 'TelepathyQt')
-rw-r--r--TelepathyQt/BaseCall13
-rw-r--r--TelepathyQt/BaseDebug12
-rw-r--r--TelepathyQt/CMakeLists.txt667
-rw-r--r--TelepathyQt/Farstream/CMakeLists.txt67
-rw-r--r--TelepathyQt/Farstream/TelepathyQtFarstream-uninstalled.pc.in2
-rw-r--r--TelepathyQt/Farstream/TelepathyQtFarstream.pc.in2
-rw-r--r--TelepathyQt/Farstream/TelepathyQtFarstreamConfig.cmake.in14
-rw-r--r--TelepathyQt/Farstream/channel.cpp14
-rw-r--r--TelepathyQt/Farstream/channel.h2
-rw-r--r--TelepathyQt/IODevice13
-rw-r--r--TelepathyQt/TelepathyQt.pc.in10
-rw-r--r--TelepathyQt/TelepathyQtConfig.cmake.in81
-rw-r--r--TelepathyQt/TelepathyQtService-uninstalled.pc.in2
-rw-r--r--TelepathyQt/TelepathyQtService.pc.in10
-rw-r--r--TelepathyQt/TelepathyQtServiceConfig.cmake.in43
-rw-r--r--TelepathyQt/abstract-adaptor.h2
-rw-r--r--TelepathyQt/abstract-client.cpp5
-rw-r--r--TelepathyQt/abstract-client.h14
-rw-r--r--TelepathyQt/abstract-interface.h2
-rw-r--r--TelepathyQt/account-factory.h4
-rw-r--r--TelepathyQt/account-manager.h2
-rw-r--r--TelepathyQt/account-property-filter.h4
-rw-r--r--TelepathyQt/account-set-internal.h4
-rw-r--r--TelepathyQt/account-set.h2
-rw-r--r--TelepathyQt/account.cpp217
-rw-r--r--TelepathyQt/account.h24
-rw-r--r--TelepathyQt/avatar.h6
-rw-r--r--TelepathyQt/base-call-internal.h136
-rw-r--r--TelepathyQt/base-call.cpp474
-rw-r--r--TelepathyQt/base-call.h186
-rw-r--r--TelepathyQt/base-channel-internal.h485
-rw-r--r--TelepathyQt/base-channel.cpp3676
-rw-r--r--TelepathyQt/base-channel.h877
-rw-r--r--TelepathyQt/base-connection-internal.h294
-rw-r--r--TelepathyQt/base-connection-manager-internal.h2
-rw-r--r--TelepathyQt/base-connection-manager.h14
-rw-r--r--TelepathyQt/base-connection.cpp2122
-rw-r--r--TelepathyQt/base-connection.h536
-rw-r--r--TelepathyQt/base-debug-internal.h58
-rw-r--r--TelepathyQt/base-debug.cpp214
-rw-r--r--TelepathyQt/base-debug.h74
-rw-r--r--TelepathyQt/base-protocol-internal.h8
-rw-r--r--TelepathyQt/base-protocol.cpp14
-rw-r--r--TelepathyQt/base-protocol.h36
-rw-r--r--TelepathyQt/call-channel.cpp6
-rw-r--r--TelepathyQt/call-channel.h2
-rw-r--r--TelepathyQt/call-content.cpp1
-rw-r--r--TelepathyQt/call-content.h4
-rw-r--r--TelepathyQt/call-interfaces.xml9
-rw-r--r--TelepathyQt/call-stream.h2
-rw-r--r--TelepathyQt/callbacks.h8
-rw-r--r--TelepathyQt/capabilities-base.h2
-rw-r--r--TelepathyQt/captcha-authentication-internal.h4
-rw-r--r--TelepathyQt/captcha-authentication.h2
-rw-r--r--TelepathyQt/captcha.h2
-rw-r--r--TelepathyQt/channel-class-features.h2
-rw-r--r--TelepathyQt/channel-class-spec.cpp12
-rw-r--r--TelepathyQt/channel-class-spec.h11
-rw-r--r--TelepathyQt/channel-dispatch-operation-internal.h2
-rw-r--r--TelepathyQt/channel-dispatch-operation.h2
-rw-r--r--TelepathyQt/channel-factory.h12
-rw-r--r--TelepathyQt/channel-request.cpp17
-rw-r--r--TelepathyQt/channel-request.h4
-rw-r--r--TelepathyQt/channel.cpp31
-rw-r--r--TelepathyQt/channel.h6
-rw-r--r--TelepathyQt/client-registrar-internal.h16
-rw-r--r--TelepathyQt/client-registrar.cpp38
-rw-r--r--TelepathyQt/client-registrar.h2
-rw-r--r--TelepathyQt/connection-capabilities.h4
-rw-r--r--TelepathyQt/connection-factory.h4
-rw-r--r--TelepathyQt/connection-lowlevel.h2
-rw-r--r--TelepathyQt/connection-manager-internal.h4
-rw-r--r--TelepathyQt/connection-manager-lowlevel.h2
-rw-r--r--TelepathyQt/connection-manager.cpp11
-rw-r--r--TelepathyQt/connection-manager.h2
-rw-r--r--TelepathyQt/connection.cpp10
-rw-r--r--TelepathyQt/connection.h7
-rw-r--r--TelepathyQt/contact-capabilities.h4
-rw-r--r--TelepathyQt/contact-factory.cpp2
-rw-r--r--TelepathyQt/contact-factory.h2
-rw-r--r--TelepathyQt/contact-manager-internal.h8
-rw-r--r--TelepathyQt/contact-manager-roster.cpp37
-rw-r--r--TelepathyQt/contact-manager.cpp4
-rw-r--r--TelepathyQt/contact-manager.h2
-rw-r--r--TelepathyQt/contact-messenger.cpp2
-rw-r--r--TelepathyQt/contact-messenger.h6
-rw-r--r--TelepathyQt/contact-search-channel.h4
-rw-r--r--TelepathyQt/contact.cpp7
-rw-r--r--TelepathyQt/contact.h6
-rw-r--r--TelepathyQt/dbus-error.cpp22
-rw-r--r--TelepathyQt/dbus-error.h2
-rw-r--r--TelepathyQt/dbus-object.cpp11
-rw-r--r--TelepathyQt/dbus-object.h14
-rw-r--r--TelepathyQt/dbus-proxy-factory-internal.h2
-rw-r--r--TelepathyQt/dbus-proxy-factory.cpp4
-rw-r--r--TelepathyQt/dbus-proxy-factory.h2
-rw-r--r--TelepathyQt/dbus-proxy.cpp2
-rw-r--r--TelepathyQt/dbus-proxy.h6
-rw-r--r--TelepathyQt/dbus-service.cpp58
-rw-r--r--TelepathyQt/dbus-service.h17
-rw-r--r--TelepathyQt/dbus-tube-channel.h2
-rw-r--r--TelepathyQt/debug-internal.h6
-rw-r--r--TelepathyQt/debug-receiver.h2
-rw-r--r--TelepathyQt/debug.cpp2
-rw-r--r--TelepathyQt/fake-handler-manager-internal.cpp6
-rw-r--r--TelepathyQt/fake-handler-manager-internal.h4
-rw-r--r--TelepathyQt/feature.h6
-rw-r--r--TelepathyQt/file-transfer-channel-creation-properties.cpp73
-rw-r--r--TelepathyQt/file-transfer-channel-creation-properties.h9
-rw-r--r--TelepathyQt/file-transfer-channel.cpp4
-rw-r--r--TelepathyQt/file-transfer-channel.h2
-rw-r--r--TelepathyQt/filter.h2
-rw-r--r--TelepathyQt/fixed-feature-factory.h4
-rw-r--r--TelepathyQt/generic-capability-filter.h6
-rw-r--r--TelepathyQt/generic-property-filter.h6
-rw-r--r--TelepathyQt/global.h.in (renamed from TelepathyQt/global.h)20
-rw-r--r--TelepathyQt/groups.dox4
-rw-r--r--TelepathyQt/handled-channel-notifier.h4
-rw-r--r--TelepathyQt/incoming-dbus-tube-channel.h2
-rw-r--r--TelepathyQt/incoming-file-transfer-channel.cpp24
-rw-r--r--TelepathyQt/incoming-file-transfer-channel.h6
-rw-r--r--TelepathyQt/incoming-stream-tube-channel.cpp4
-rw-r--r--TelepathyQt/incoming-stream-tube-channel.h2
-rw-r--r--TelepathyQt/io-device.cpp107
-rw-r--r--TelepathyQt/io-device.h58
-rw-r--r--TelepathyQt/key-file.h2
-rw-r--r--TelepathyQt/location-info.cpp4
-rw-r--r--TelepathyQt/location-info.h4
-rw-r--r--TelepathyQt/main.dox95
-rw-r--r--TelepathyQt/manager-file.cpp2
-rw-r--r--TelepathyQt/manager-file.h2
-rw-r--r--TelepathyQt/message-content-part.h6
-rw-r--r--TelepathyQt/message.cpp34
-rw-r--r--TelepathyQt/message.h21
-rw-r--r--TelepathyQt/method-invocation-context.h18
-rw-r--r--TelepathyQt/object.h2
-rw-r--r--TelepathyQt/optional-interface-factory.cpp2
-rw-r--r--TelepathyQt/optional-interface-factory.h4
-rw-r--r--TelepathyQt/outgoing-dbus-tube-channel.h2
-rw-r--r--TelepathyQt/outgoing-file-transfer-channel.cpp32
-rw-r--r--TelepathyQt/outgoing-file-transfer-channel.h6
-rw-r--r--TelepathyQt/outgoing-stream-tube-channel-internal.h6
-rw-r--r--TelepathyQt/outgoing-stream-tube-channel.cpp2
-rw-r--r--TelepathyQt/outgoing-stream-tube-channel.h2
-rw-r--r--TelepathyQt/pending-account.h2
-rw-r--r--TelepathyQt/pending-captchas.h2
-rw-r--r--TelepathyQt/pending-channel-request-internal.h2
-rw-r--r--TelepathyQt/pending-channel-request.cpp24
-rw-r--r--TelepathyQt/pending-channel-request.h2
-rw-r--r--TelepathyQt/pending-channel.cpp14
-rw-r--r--TelepathyQt/pending-channel.h2
-rw-r--r--TelepathyQt/pending-connection.h2
-rw-r--r--TelepathyQt/pending-contact-attributes.h2
-rw-r--r--TelepathyQt/pending-contact-info.h2
-rw-r--r--TelepathyQt/pending-contacts-internal.h2
-rw-r--r--TelepathyQt/pending-contacts.cpp10
-rw-r--r--TelepathyQt/pending-contacts.h2
-rw-r--r--TelepathyQt/pending-dbus-tube-connection.h2
-rw-r--r--TelepathyQt/pending-debug-message-list.h2
-rw-r--r--TelepathyQt/pending-handles.h2
-rw-r--r--TelepathyQt/pending-operation.h2
-rw-r--r--TelepathyQt/pending-ready.h2
-rw-r--r--TelepathyQt/pending-send-message.h2
-rw-r--r--TelepathyQt/pending-stream-tube-connection.h2
-rw-r--r--TelepathyQt/pending-string-list.h2
-rw-r--r--TelepathyQt/pending-string.h2
-rw-r--r--TelepathyQt/pending-variant-map.h2
-rw-r--r--TelepathyQt/pending-variant.h2
-rw-r--r--TelepathyQt/presence.h12
-rw-r--r--TelepathyQt/profile-manager.h2
-rw-r--r--TelepathyQt/profile.cpp12
-rw-r--r--TelepathyQt/profile.h6
-rw-r--r--TelepathyQt/protocol-info.cpp4
-rw-r--r--TelepathyQt/protocol-info.h6
-rw-r--r--TelepathyQt/protocol-parameter.h6
-rw-r--r--TelepathyQt/readiness-helper.cpp10
-rw-r--r--TelepathyQt/readiness-helper.h11
-rw-r--r--TelepathyQt/referenced-handles.cpp4
-rw-r--r--TelepathyQt/referenced-handles.h2
-rw-r--r--TelepathyQt/request-temporary-handler-internal.h6
-rw-r--r--TelepathyQt/requestable-channel-class-spec.h6
-rw-r--r--TelepathyQt/room-list-channel.h2
-rw-r--r--TelepathyQt/server-authentication-channel.h2
-rw-r--r--TelepathyQt/service-types.h94
-rw-r--r--TelepathyQt/shared-ptr.h22
-rw-r--r--TelepathyQt/simple-call-observer.h2
-rw-r--r--TelepathyQt/simple-observer-internal.h10
-rw-r--r--TelepathyQt/simple-observer.cpp2
-rw-r--r--TelepathyQt/simple-observer.h2
-rw-r--r--TelepathyQt/simple-pending-operations.h2
-rw-r--r--TelepathyQt/simple-stream-tube-handler.cpp8
-rw-r--r--TelepathyQt/simple-stream-tube-handler.h8
-rw-r--r--TelepathyQt/simple-text-observer-internal.h2
-rw-r--r--TelepathyQt/simple-text-observer.h2
-rw-r--r--TelepathyQt/stable-interfaces.xml2
-rw-r--r--TelepathyQt/stream-tube-channel.h2
-rw-r--r--TelepathyQt/stream-tube-client-internal.h2
-rw-r--r--TelepathyQt/stream-tube-client.cpp12
-rw-r--r--TelepathyQt/stream-tube-client.h6
-rw-r--r--TelepathyQt/stream-tube-server-internal.h2
-rw-r--r--TelepathyQt/stream-tube-server.cpp6
-rw-r--r--TelepathyQt/stream-tube-server.h6
-rw-r--r--TelepathyQt/streamed-media-channel.h6
-rw-r--r--TelepathyQt/svc-call.xml12
-rw-r--r--TelepathyQt/svc-channel.xml2
-rw-r--r--TelepathyQt/svc-debug.xml9
-rw-r--r--TelepathyQt/test-backdoors.cpp2
-rw-r--r--TelepathyQt/text-channel.cpp16
-rw-r--r--TelepathyQt/text-channel.h6
-rw-r--r--TelepathyQt/tube-channel.h2
-rw-r--r--TelepathyQt/utils.cpp15
211 files changed, 10267 insertions, 1698 deletions
diff --git a/TelepathyQt/BaseCall b/TelepathyQt/BaseCall
new file mode 100644
index 00000000..b7656e45
--- /dev/null
+++ b/TelepathyQt/BaseCall
@@ -0,0 +1,13 @@
+#ifndef _TelepathyQt_BaseCall_HEADER_GUARD_
+#define _TelepathyQt_BaseCall_HEADER_GUARD_
+
+#ifndef IN_TP_QT_HEADER
+#define IN_TP_QT_HEADER
+#endif
+
+#include <TelepathyQt/base-call.h>
+
+#undef IN_TP_QT_HEADER
+
+#endif
+// vim:set ft=cpp:
diff --git a/TelepathyQt/BaseDebug b/TelepathyQt/BaseDebug
new file mode 100644
index 00000000..3cb79f19
--- /dev/null
+++ b/TelepathyQt/BaseDebug
@@ -0,0 +1,12 @@
+#ifndef _TelepathyQt_BaseDebug_HEADER_GUARD_
+#define _TelepathyQt_BaseDebug_HEADER_GUARD_
+
+#ifndef IN_TP_QT_HEADER
+#define IN_TP_QT_HEADER
+#endif
+
+#include <TelepathyQt/base-debug.h>
+
+#undef IN_TP_QT_HEADER
+
+#endif // _TelepathyQt_BaseDebug_HEADER_GUARD_
diff --git a/TelepathyQt/CMakeLists.txt b/TelepathyQt/CMakeLists.txt
index 8e41f863..ae755f02 100644
--- a/TelepathyQt/CMakeLists.txt
+++ b/TelepathyQt/CMakeLists.txt
@@ -4,69 +4,68 @@ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_gen")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VISIBILITY_HIDDEN_FLAGS} ${COMPILER_COVERAGE_FLAGS} ${DEPRECATED_DECLARATIONS_FLAGS}")
set(LD_FLAGS "${LD_FLAGS} ${VISIBILITY_HIDDEN_FLAGS} ${COMPILER_COVERAGE_FLAGS} ${DEPRECATED_DECLARATIONS_FLAGS}")
-# We are building Telepathy-Qt
-add_definitions(-DBUILDING_TP_QT)
+configure_file(global.h.in ${CMAKE_CURRENT_BINARY_DIR}/global.h)
# Sources for Tp-Qt
set(telepathy_qt_SRCS
abstract-client.cpp
abstract-interface.cpp
- account.cpp
account-factory.cpp
account-manager.cpp
account-property-filter.cpp
- account-set.cpp
account-set-internal.h
+ account-set.cpp
+ account.cpp
avatar.cpp
call-channel.cpp
+ call-content-media-description.cpp
call-content.cpp
- call-stream.cpp
- capabilities-base.cpp
call-content.cpp
- call-content-media-description.cpp
- call-stream.cpp
call-stream-endpoint.cpp
- captcha.cpp
+ call-stream.cpp
+ call-stream.cpp
+ capabilities-base.cpp
captcha-authentication.cpp
- channel.cpp
+ captcha.cpp
channel-class-spec.cpp
- channel-dispatcher.cpp
channel-dispatch-operation.cpp
+ channel-dispatcher.cpp
channel-factory.cpp
channel-internal.h
channel-request.cpp
- client.cpp
- client-registrar.cpp
+ channel.cpp
client-registrar-internal.h
- connection.cpp
+ client-registrar.cpp
+ client.cpp
connection-capabilities.cpp
connection-factory.cpp
connection-internal.h
- connection-manager.cpp
connection-manager-internal.h
- contact.cpp
+ connection-manager.cpp
+ connection.cpp
contact-capabilities.cpp
contact-factory.cpp
- contact-manager.cpp
contact-manager-roster.cpp
+ contact-manager.cpp
contact-messenger.cpp
contact-search-channel.cpp
- dbus.cpp
- dbus-proxy.cpp
- dbus-proxy-factory.cpp
+ contact.cpp
dbus-proxy-factory-internal.h
+ dbus-proxy-factory.cpp
+ dbus-proxy.cpp
dbus-tube-channel.cpp
- debug.cpp
- debug-receiver.cpp
+ dbus.cpp
debug-internal.h
+ debug-receiver.cpp
+ debug.cpp
fake-handler-manager-internal.cpp
fake-handler-manager-internal.h
feature.cpp
- file-transfer-channel.cpp
file-transfer-channel-creation-properties.cpp
+ file-transfer-channel.cpp
fixed-feature-factory.cpp
- future.cpp
future-internal.h
+ future.cpp
handled-channel-notifier.cpp
incoming-dbus-tube-channel.cpp
incoming-file-transfer-channel.cpp
@@ -78,8 +77,8 @@ set(telepathy_qt_SRCS
manager-file.h
media-session-handler.cpp
media-stream-handler.cpp
- message.cpp
message-content-part.cpp
+ message.cpp
object.cpp
optional-interface-factory.cpp
outgoing-dbus-tube-channel.cpp
@@ -87,9 +86,9 @@ set(telepathy_qt_SRCS
outgoing-stream-tube-channel.cpp
pending-account.cpp
pending-captchas.cpp
- pending-channel.cpp
- pending-channel-request.cpp
pending-channel-request-internal.h
+ pending-channel-request.cpp
+ pending-channel.cpp
pending-connection.cpp
pending-contact-attributes.cpp
pending-contact-info.cpp
@@ -100,149 +99,124 @@ set(telepathy_qt_SRCS
pending-operation.cpp
pending-ready.cpp
pending-send-message.cpp
- pending-string.cpp
- pending-string-list.cpp
pending-stream-tube-connection.cpp
+ pending-string-list.cpp
+ pending-string.cpp
+ pending-variant-map.cpp
pending-variant.cpp
presence.cpp
- pending-variant-map.cpp
- profile.cpp
profile-manager.cpp
+ profile.cpp
properties.cpp
protocol-info.cpp
protocol-parameter.cpp
readiness-helper.cpp
- requestable-channel-class-spec.cpp
ready-object.cpp
referenced-handles.cpp
request-temporary-handler-internal.cpp
request-temporary-handler-internal.h
+ requestable-channel-class-spec.cpp
room-list-channel.cpp
server-authentication-channel.cpp
simple-call-observer.cpp
- simple-observer.cpp
simple-observer-internal.h
+ simple-observer.cpp
simple-stream-tube-handler.cpp
- simple-text-observer.cpp
simple-text-observer-internal.h
+ simple-text-observer.cpp
stream-tube-channel.cpp
- stream-tube-client.cpp
stream-tube-client-internal.h
- stream-tube-server.cpp
+ stream-tube-client.cpp
stream-tube-server-internal.h
+ stream-tube-server.cpp
streamed-media-channel.cpp
text-channel.cpp
tls-certificate.cpp
tube-channel.cpp
- types.cpp
types-internal.h
- utils.cpp)
+ types.cpp
+ utils.cpp
+)
# Exported headers for Tp-Qt
set(telepathy_qt_HEADERS
+ ${CMAKE_CURRENT_BINARY_DIR}/global.h
AbstractClient
AbstractClientApprover
- abstract-client.h
AbstractClientHandler
AbstractClientObserver
AbstractInterface
- abstract-interface.h
Account
- account.h
AccountCapabilityFilter
- account-capability-filter.h
AccountFactory
- account-factory.h
AccountFilter
- account-filter.h
AccountInterface
AccountInterfaceAddressingInterface
AccountInterfaceAvatarInterface
AccountInterfaceStorageInterface
AccountManager
- account-manager.h
AccountManagerInterface
- account-property-filter.h
AccountPropertyFilter
AccountSet
- account-set.h
AndFilter
- and-filter.h
AuthenticationTLSCertificateInterface
AvatarData
AvatarSpec
- avatar.h
CallChannel
- call-channel.h
- Callbacks
- callbacks.h
CallContent
CallContentInterface
CallContentInterfaceAudioControlInterface
CallContentInterfaceDTMFInterface
CallContentInterfaceMediaInterface
CallContentInterfaceVideoControlInterface
- call-content.h
CallContentMediaDescription
CallContentMediaDescriptionInterface
CallContentMediaDescriptionInterfaceRTCPExtendedReportsInterface
CallContentMediaDescriptionInterfaceRTCPFeedbackInterface
CallContentMediaDescriptionInterfaceRTPHeaderExtensionsInterface
- call-content-media-description.h
CallStream
- CallStreamInterface
- CallStreamInterfaceMediaInterface
- call-stream.h
CallStreamEndpoint
CallStreamEndpoint
CallStreamEndpointInterface
- call-stream-endpoint.h
+ CallStreamInterface
+ CallStreamInterfaceMediaInterface
+ Callbacks
CapabilitiesBase
- capabilities-base.h
Captcha
- captcha.h
CaptchaAuthentication
- captcha-authentication.h
Channel
- channel.h
ChannelClassFeatures
- channel-class-features.h
ChannelClassSpec
ChannelClassSpecList
- channel-class-spec.h
- ChannelDispatcher
- ChannelDispatcherInterface
- channel-dispatcher.h
ChannelDispatchOperation
- channel-dispatch-operation.h
ChannelDispatchOperationInterface
+ ChannelDispatcher
+ ChannelDispatcherInterface
ChannelFactory
- channel-factory.h
ChannelInterface
ChannelInterfaceAnonymityInterface
- ChannelInterfaceCaptchaAuthenticationInterface
ChannelInterfaceCallStateInterface
+ ChannelInterfaceCaptchaAuthenticationInterface
ChannelInterfaceChatStateInterface
ChannelInterfaceConferenceInterface
- ChannelInterfaceDestroyableInterface
ChannelInterfaceDTMFInterface
+ ChannelInterfaceDestroyableInterface
ChannelInterfaceFileTransferMetadataInterface
ChannelInterfaceGroupInterface
ChannelInterfaceHoldInterface
ChannelInterfaceMediaSignallingInterface
ChannelInterfaceMessagesInterface
ChannelInterfacePasswordInterface
- ChannelInterfaceRoomInterface
ChannelInterfaceRoomConfigInterface
+ ChannelInterfaceRoomInterface
ChannelInterfaceSASLAuthenticationInterface
+ ChannelInterfaceSMSInterface
ChannelInterfaceSecurableInterface
ChannelInterfaceServicePointInterface
- ChannelInterfaceSMSInterface
ChannelInterfaceSubjectInterface
ChannelInterfaceTubeInterface
ChannelRequest
ChannelRequestHints
- channel-request.h
ChannelRequestInterface
ChannelTypeCallInterface
ChannelTypeContactListInterface
@@ -252,27 +226,21 @@ set(telepathy_qt_HEADERS
ChannelTypeRoomListInterface
ChannelTypeServerAuthenticationInterface
ChannelTypeServerTLSConnectionInterface
- ChannelTypeStreamedMediaInterface
ChannelTypeStreamTubeInterface
+ ChannelTypeStreamedMediaInterface
ChannelTypeTextInterface
ChannelTypeTubeInterface
ChannelTypeTubesInterface
Client
ClientApproverInterface
- client.h
ClientHandlerInterface
ClientInterface
ClientInterfaceRequestsInterface
ClientObserverInterface
ClientRegistrar
- client-registrar.h
Connection
ConnectionCapabilities
- connection-capabilities.h
- connection.h
ConnectionFactory
- connection-factory.h
- connection-lowlevel.h
ConnectionInterface
ConnectionInterfaceAddressingInterface
ConnectionInterfaceAliasingInterface
@@ -281,8 +249,8 @@ set(telepathy_qt_HEADERS
ConnectionInterfaceBalanceInterface
ConnectionInterfaceCapabilitiesInterface
ConnectionInterfaceCellularInterface
- ConnectionInterfaceContactBlockingInterface
ConnectionInterfaceClientTypesInterface
+ ConnectionInterfaceContactBlockingInterface
ConnectionInterfaceContactCapabilitiesInterface
ConnectionInterfaceContactGroupsInterface
ConnectionInterfaceContactInfoInterface
@@ -297,223 +265,256 @@ set(telepathy_qt_HEADERS
ConnectionInterfaceSimplePresenceInterface
ConnectionLowlevel
ConnectionManager
- connection-manager.h
- connection-manager-lowlevel.h
ConnectionManagerInterface
ConnectionManagerLowlevel
Constants
- constants.h
Contact
- contact.h
ContactCapabilities
- contact-capabilities.h
ContactFactory
- contact-factory.h
ContactManager
- contact-manager.h
ContactMessenger
- contact-messenger.h
ContactSearchChannel
- contact-search-channel.h
DBus
DBusDaemonInterface
- dbus.h
DBusProxy
- dbus-proxy.h
DBusProxyFactory
- dbus-proxy-factory.h
DBusTubeChannel
- dbus-tube-channel.h
Debug
- debug.h
DebugReceiver
- debug-receiver.h
Feature
Features
- feature.h
FileTransferChannel
FileTransferChannelCreationProperties
- file-transfer-channel-creation-properties.h
- file-transfer-channel.h
Filter
- filter.h
FixedFeatureFactory
- fixed-feature-factory.h
Functors
- functors.h
GenericCapabilityFilter
- generic-capability-filter.h
GenericPropertyFilter
- generic-property-filter.h
Global
- global.h
HandledChannelNotifier
- handled-channel-notifier.h
IncomingDBusTubeChannel
- incoming-dbus-tube-channel.h
IncomingFileTransferChannel
- incoming-file-transfer-channel.h
IncomingStreamTubeChannel
- incoming-stream-tube-channel.h
IntrospectableInterface
LocationInfo
- location-info.h
MediaSessionHandler
- media-session-handler.h
MediaSessionHandlerInterface
MediaStreamHandler
- media-stream-handler.h
MediaStreamHandlerInterface
Message
- message.h
MessageContentPart
MessageContentPartList
- message-content-part.h
MethodInvocationContext
- method-invocation-context.h
NotFilter
- not-filter.h
Object
- object.h
OptionalInterfaceFactory
- optional-interface-factory.h
OrFilter
- or-filter.h
OutgoingDBusTubeChannel
- outgoing-dbus-tube-channel.h
OutgoingFileTransferChannel
- outgoing-file-transfer-channel.h
OutgoingStreamTubeChannel
- outgoing-stream-tube-channel.h
PeerInterface
PendingAccount
- pending-account.h
PendingCallContent
PendingCaptchas
- pending-captchas.h
PendingChannel
- pending-channel.h
PendingChannelRequest
- pending-channel-request.h
PendingComposite
PendingConnection
- pending-connection.h
PendingContactAttributes
- pending-contact-attributes.h
PendingContactInfo
- pending-contact-info.h
PendingContacts
- pending-contacts.h
PendingDBusTubeConnection
- pending-dbus-tube-connection.h
PendingDebugMessageList
- pending-debug-message-list.h
PendingFailure
PendingHandles
- pending-handles.h
PendingOperation
- pending-operation.h
PendingReady
- pending-ready.h
PendingSendMessage
- pending-send-message.h
- PendingStreamedMediaStreams
PendingStreamTubeConnection
- pending-stream-tube-connection.h
+ PendingStreamedMediaStreams
PendingString
- pending-string.h
PendingStringList
- pending-string-list.h
PendingSuccess
PendingVariant
- pending-variant.h
PendingVariantMap
- pending-variant-map.h
PendingVoid
Presence
- presence.h
PresenceSpec
PresenceSpecList
Profile
- profile.h
ProfileManager
- profile-manager.h
Properties
- properties.h
PropertiesInterface
PropertiesInterfaceInterface
ProtocolInfo
ProtocolInfoList
- protocol-info.h
ProtocolInterface
ProtocolInterfaceAddressingInterface
ProtocolInterfaceAvatarsInterface
ProtocolInterfacePresenceInterface
ProtocolParameter
ProtocolParameterList
- protocol-parameter.h
ReadinessHelper
- readiness-helper.h
ReadyObject
- ready-object.h
ReceivedMessage
RefCounted
ReferencedHandles
- referenced-handles.h
ReferencedHandlesIterator
- requestable-channel-class-spec.h
RequestableChannelClassSpec
RequestableChannelClassSpecList
RoomListChannel
- room-list-channel.h
ServerAuthenticationChannel
- server-authentication-channel.h
SharedPtr
- shared-ptr.h
+ SharedPtr
SimpleCallObserver
- simple-call-observer.h
SimpleObserver
- simple-observer.h
- simple-pending-operations.h
SimpleTextObserver
- simple-text-observer.h
StatefulDBusProxy
StatelessDBusProxy
StreamTubeChannel
StreamTubeClient
StreamTubeServer
+ StreamedMediaChannel
+ StreamedMediaStream
+ TextChannel
+ TubeChannel
+ Types
+ Utils
+ abstract-client.h
+ abstract-interface.h
+ account-capability-filter.h
+ account-factory.h
+ account-filter.h
+ account-manager.h
+ account-property-filter.h
+ account-set.h
+ account.h
+ and-filter.h
+ avatar.h
+ call-channel.h
+ call-content-media-description.h
+ call-content.h
+ call-stream-endpoint.h
+ call-stream.h
+ callbacks.h
+ capabilities-base.h
+ captcha-authentication.h
+ captcha.h
+ channel-class-features.h
+ channel-class-spec.h
+ channel-dispatch-operation.h
+ channel-dispatcher.h
+ channel-factory.h
+ channel-request.h
+ channel.h
+ client-registrar.h
+ client.h
+ connection-capabilities.h
+ connection-factory.h
+ connection-lowlevel.h
+ connection-manager-lowlevel.h
+ connection-manager.h
+ connection.h
+ constants.h
+ contact-capabilities.h
+ contact-factory.h
+ contact-manager.h
+ contact-messenger.h
+ contact-search-channel.h
+ contact.h
+ dbus-proxy-factory.h
+ dbus-proxy.h
+ dbus-tube-channel.h
+ dbus.h
+ debug-receiver.h
+ debug.h
+ feature.h
+ file-transfer-channel-creation-properties.h
+ file-transfer-channel.h
+ filter.h
+ fixed-feature-factory.h
+ functors.h
+ generic-capability-filter.h
+ generic-property-filter.h
+ handled-channel-notifier.h
+ incoming-dbus-tube-channel.h
+ incoming-file-transfer-channel.h
+ incoming-stream-tube-channel.h
+ location-info.h
+ media-session-handler.h
+ media-stream-handler.h
+ message-content-part.h
+ message.h
+ method-invocation-context.h
+ not-filter.h
+ object.h
+ optional-interface-factory.h
+ or-filter.h
+ outgoing-dbus-tube-channel.h
+ outgoing-file-transfer-channel.h
+ outgoing-stream-tube-channel.h
+ pending-account.h
+ pending-captchas.h
+ pending-channel-request.h
+ pending-channel.h
+ pending-connection.h
+ pending-contact-attributes.h
+ pending-contact-info.h
+ pending-contacts.h
+ pending-dbus-tube-connection.h
+ pending-debug-message-list.h
+ pending-handles.h
+ pending-operation.h
+ pending-ready.h
+ pending-send-message.h
+ pending-stream-tube-connection.h
+ pending-string-list.h
+ pending-string.h
+ pending-variant-map.h
+ pending-variant.h
+ presence.h
+ profile-manager.h
+ profile.h
+ properties.h
+ protocol-info.h
+ protocol-parameter.h
+ readiness-helper.h
+ ready-object.h
+ referenced-handles.h
+ requestable-channel-class-spec.h
+ room-list-channel.h
+ server-authentication-channel.h
+ shared-ptr.h
+ simple-call-observer.h
+ simple-observer.h
+ simple-pending-operations.h
+ simple-text-observer.h
stream-tube-channel.h
stream-tube-client.h
stream-tube-server.h
- StreamedMediaChannel
streamed-media-channel.h
- StreamedMediaStream
- TextChannel
text-channel.h
tls-certificate.h
- TubeChannel
tube-channel.h
- Types
types.h
- Utils
utils.h
- SharedPtr)
+)
# Generated headers which will be installed and exported
set(telepathy_qt_gen_HEADERS
- ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-account.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-account-manager.h
- ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-call-content.h
+ ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-account.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-call-content-media-description.h
- ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-call-stream.h
+ ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-call-content.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-call-stream-endpoint.h
- ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-channel.h
- ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-channel-dispatcher.h
+ ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-call-stream.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-channel-dispatch-operation.h
+ ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-channel-dispatcher.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-channel-request.h
+ ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-channel.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-client.h
- ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection-manager.h
+ ${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-connection.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-dbus.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-debug-receiver.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-media-session-handler.h
@@ -521,46 +522,47 @@ set(telepathy_qt_gen_HEADERS
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-properties.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/cli-tls-certificate.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/constants.h
- ${CMAKE_CURRENT_BINARY_DIR}/_gen/types.h)
+ ${CMAKE_CURRENT_BINARY_DIR}/_gen/types.h
+)
# Headers file moc will be run on
set(telepathy_qt_MOC_SRCS
abstract-interface.h
- account.h
account-factory.h
account-manager.h
- account-set.h
account-set-internal.h
+ account-set.h
+ account.h
call-channel.h
call-content.h
call-stream.h
- captcha-authentication.h
captcha-authentication-internal.h
- channel.h
- channel-dispatch-operation.h
+ captcha-authentication.h
channel-dispatch-operation-internal.h
+ channel-dispatch-operation.h
channel-factory.h
channel-internal.h
channel-request.h
- client-registrar.h
+ channel.h
client-registrar-internal.h
- connection.h
+ client-registrar.h
connection-internal.h
connection-lowlevel.h
- connection-manager.h
connection-manager-internal.h
connection-manager-lowlevel.h
- contact.h
- contact-manager.h
+ connection-manager.h
+ connection.h
contact-manager-internal.h
+ contact-manager.h
contact-messenger.h
- contact-search-channel.h
contact-search-channel-internal.h
- dbus-proxy.h
- dbus-proxy-factory.h
+ contact-search-channel.h
+ contact.h
dbus-proxy-factory-internal.h
- debug-receiver.h
+ dbus-proxy-factory.h
+ dbus-proxy.h
dbus-tube-channel.h
+ debug-receiver.h
fake-handler-manager-internal.h
file-transfer-channel.h
fixed-feature-factory.h
@@ -571,18 +573,18 @@ set(telepathy_qt_MOC_SRCS
object.h
outgoing-dbus-tube-channel.h
outgoing-file-transfer-channel.h
- outgoing-stream-tube-channel.h
outgoing-stream-tube-channel-internal.h
+ outgoing-stream-tube-channel.h
pending-account.h
pending-captchas.h
- pending-channel.h
- pending-channel-request.h
pending-channel-request-internal.h
+ pending-channel-request.h
+ pending-channel.h
pending-connection.h
pending-contact-attributes.h
pending-contact-info.h
- pending-contacts.h
pending-contacts-internal.h
+ pending-contacts.h
pending-dbus-tube-connection.h
pending-debug-message-list.h
pending-handles.h
@@ -590,37 +592,39 @@ set(telepathy_qt_MOC_SRCS
pending-ready.h
pending-send-message.h
pending-stream-tube-connection.h
- pending-string.h
pending-string-list.h
- pending-variant.h
+ pending-string.h
pending-variant-map.h
+ pending-variant.h
profile-manager.h
readiness-helper.h
request-temporary-handler-internal.h
room-list-channel.h
server-authentication-channel.h
simple-call-observer.h
- simple-pending-operations.h
- simple-observer.h
simple-observer-internal.h
+ simple-observer.h
+ simple-pending-operations.h
simple-stream-tube-handler.h
- simple-text-observer.h
simple-text-observer-internal.h
+ simple-text-observer.h
stream-tube-channel.h
- stream-tube-client.h
stream-tube-client-internal.h
- stream-tube-server.h
+ stream-tube-client.h
stream-tube-server-internal.h
+ stream-tube-server.h
streamed-media-channel.h
text-channel.h
- tube-channel.h)
+ tube-channel.h
+)
# Sources for test library, used by tests to test some unexported functionality
set(telepathy_qt_test_backdoors_SRCS
key-file.cpp
manager-file.cpp
test-backdoors.cpp
- utils.cpp)
+ utils.cpp
+)
# Generate the spec files for both stable and future spec
set(gen_stable_spec_xml ${CMAKE_CURRENT_BINARY_DIR}/_gen/stable-spec.xml)
@@ -668,8 +672,8 @@ set(SPECS
call-stream
call-stream-endpoint
channel
- channel-dispatcher
channel-dispatch-operation
+ channel-dispatcher
channel-request
client
connection
@@ -679,7 +683,9 @@ set(SPECS
media-session-handler
media-stream-handler
properties
- tls-certificate)
+ tls-certificate
+)
+
foreach(spec ${SPECS})
tpqt_xincludator(${spec}-spec-xincludator ${CMAKE_CURRENT_SOURCE_DIR}/${spec}.xml ${CMAKE_CURRENT_BINARY_DIR}/_gen/spec-${spec}.xml
DEPENDS stable-typesgen)
@@ -689,7 +695,7 @@ foreach(spec ${SPECS})
list(APPEND telepathy_qt_SRCS ${NEW_FILES})
list(APPEND telepathy_qt_generated_specs_mocs "moc-cli-${spec}.moc.hpp")
set_source_files_properties(${NEW_FILES} PROPERTIES GENERATED true)
-endforeach(spec ${SPECS})
+endforeach()
set(FUTURE_SPECS
channel
@@ -705,14 +711,14 @@ foreach(spec ${FUTURE_SPECS})
list(APPEND telepathy_qt_SRCS ${NEW_FILES})
list(APPEND telepathy_qt_generated_specs_mocs "moc-future-${spec}.moc.hpp")
set_source_files_properties(${NEW_FILES} PROPERTIES GENERATED true)
-endforeach(spec ${FUTURE_SPECS})
+endforeach()
# The escape character in MSVC is ^
if(MSVC)
set(TYPES_INCLUDE ^<TelepathyQt/Types^> )
-else(MSVC)
+else()
set(TYPES_INCLUDE '<TelepathyQt/Types>' )
-endif(MSVC)
+endif()
# Use the client generator for generating headers out of specs
tpqt_client_generator(account clientaccount AccountManager Tp::Client --mainiface=Tp::Client::AccountInterface DEPENDS account-spec-xincludator)
@@ -741,17 +747,28 @@ tpqt_future_client_generator(misc TpFuture::Client DEPENDS misc-future-xincludat
if (TARGET doxygen-doc)
add_dependencies(doxygen-doc all-generated-sources)
-endif (TARGET doxygen-doc)
+endif ()
# Create the library
if (ENABLE_COMPILER_COVERAGE)
add_library(telepathy-qt${QT_VERSION_MAJOR} STATIC ${telepathy_qt_SRCS})
-else (ENABLE_COMPILER_COVERAGE)
+else ()
add_library(telepathy-qt${QT_VERSION_MAJOR} SHARED ${telepathy_qt_SRCS})
-endif (ENABLE_COMPILER_COVERAGE)
+endif ()
+add_library(TelepathyQt${QT_VERSION_MAJOR}::Core ALIAS telepathy-qt${QT_VERSION_MAJOR})
+
+# We are building Telepathy-Qt
+target_compile_definitions(telepathy-qt${QT_VERSION_MAJOR} PRIVATE BUILDING_TP_QT)
# Library used by tests to test some unexported functionality
add_library(telepathy-qt-test-backdoors STATIC ${telepathy_qt_test_backdoors_SRCS})
+target_include_directories(telepathy-qt-test-backdoors PUBLIC
+ $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}/>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/..>
+)
+
add_dependencies(telepathy-qt-test-backdoors stable-constants)
add_dependencies(telepathy-qt-test-backdoors stable-typesgen)
@@ -764,31 +781,48 @@ foreach(moc_src ${telepathy_qt_MOC_SRCS})
list(APPEND telepathy_qt_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${generated_file})
string(REPLACE ".h" ".moc.hpp" moc_src ${moc_src})
add_dependencies(telepathy-qt${QT_VERSION_MAJOR} "moc-${moc_src}")
-endforeach(moc_src ${telepathy_qt_MOC_SRCS})
+endforeach()
# Link
-target_link_libraries(telepathy-qt${QT_VERSION_MAJOR}
- ${QT_QTCORE_LIBRARY}
- ${QT_QTDBUS_LIBRARY}
- ${QT_QTNETWORK_LIBRARY}
- ${QT_QTXML_LIBRARY}
+target_link_libraries(telepathy-qt${QT_VERSION_MAJOR} PUBLIC
+ Qt5::Core
+ Qt5::DBus
+ Qt5::Network
+)
+
+target_link_libraries(telepathy-qt${QT_VERSION_MAJOR} PRIVATE
+ Qt5::Xml
+)
+
+target_link_libraries(telepathy-qt${QT_VERSION_MAJOR} PUBLIC
${TP_QT_LIBRARY_LINKER_FLAGS})
+target_include_directories(telepathy-qt${QT_VERSION_MAJOR} PUBLIC
+ $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}/>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/..>
+)
+
# Link - Library used by tests to test some unexported functionality
-target_link_libraries(telepathy-qt-test-backdoors
- ${QT_QTCORE_LIBRARY}
- ${QT_QTDBUS_LIBRARY}
- ${QT_QTNETWORK_LIBRARY}
- ${QT_QTXML_LIBRARY}
+target_link_libraries(telepathy-qt-test-backdoors PUBLIC
+ Qt5::Core
+ Qt5::DBus
+ Qt5::Network
+ Qt5::Xml
+)
+
+target_link_libraries(telepathy-qt-test-backdoors PUBLIC
${TP_QT_LIBRARY_LINKER_FLAGS})
if (ENABLE_COMPILER_COVERAGE)
- target_link_libraries(telepathy-qt${QT_VERSION_MAJOR} gcov)
- target_link_libraries(telepathy-qt-test-backdoors gcov)
-endif (ENABLE_COMPILER_COVERAGE)
+ target_link_libraries(telepathy-qt${QT_VERSION_MAJOR} PRIVATE gcov)
+ target_link_libraries(telepathy-qt-test-backdoors PRIVATE gcov)
+endif ()
# Set the correct version number
set_target_properties(telepathy-qt${QT_VERSION_MAJOR} PROPERTIES
+ EXPORT_NAME Core
SOVERSION ${TP_QT_ABI_VERSION}
VERSION ${TP_QT_LIBRARY_VERSION})
@@ -797,52 +831,42 @@ set_target_properties(telepathy-qt${QT_VERSION_MAJOR} PROPERTIES
install(FILES ${telepathy_qt_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}/TelepathyQt COMPONENT headers)
install(FILES ${telepathy_qt_gen_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}/TelepathyQt/_gen COMPONENT headers)
-# Install the library - watch out for the correct components
-if (WIN32)
- install(TARGETS telepathy-qt${QT_VERSION_MAJOR}
- EXPORT TelepathyQt${QT_VERSION_MAJOR}Targets
- RUNTIME DESTINATION ${LIB_INSTALL_DIR} COMPONENT mainlibrary
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT libs)
-else (WIN32)
- install(TARGETS telepathy-qt${QT_VERSION_MAJOR}
- EXPORT TelepathyQt${QT_VERSION_MAJOR}Targets
- LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT mainlibrary
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT libs)
-endif (WIN32)
+# Install the library
+install(TARGETS telepathy-qt${QT_VERSION_MAJOR}
+ EXPORT TelepathyQt${QT_VERSION_MAJOR}Targets
+ RUNTIME DESTINATION ${LIB_INSTALL_DIR} COMPONENT mainlibrary
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT mainlibrary
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT libs)
# pkg-config files, only if we are not using windows
if (NOT WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQt.pc.in ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQt-uninstalled.pc.in ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}-uninstalled.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig COMPONENT pkgconfig)
-endif (NOT WIN32)
+endif ()
-# CMake Version and config files
-include(MacroWriteBasicCMakeVersionFile)
+# Find out the correct installation directory
+set(_TelepathyQtConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/TelepathyQt${QT_VERSION_MAJOR})
-# all the following variables are put into TelepathyQt*Config.cmake, so
-# they are usable by projects using TelepathyQt.
-make_install_path_absolute(TELEPATHY_QT_INCLUDE_DIR ${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR})
-make_install_path_absolute(TELEPATHY_QT_LIB_DIR ${LIB_INSTALL_DIR})
-make_install_path_absolute(TELEPATHY_QT_DATA_DIR ${DATA_INSTALL_DIR})
+# CMake Version and config files
+include(CMakePackageConfigHelpers)
# Configure the actual Config file
-configure_file(TelepathyQtConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}Config.cmake" @ONLY)
+configure_package_config_file(TelepathyQtConfig.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}Config.cmake"
+ INSTALL_DESTINATION ${_TelepathyQtConfig_INSTALL_DIR}
+ PATH_VARS CMAKE_INSTALL_PREFIX INCLUDE_INSTALL_DIR LIB_INSTALL_DIR
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO)
# this file is used by to check if the installed version can be used.
-macro_write_basic_cmake_version_file(${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}ConfigVersion.cmake
- ${PACKAGE_VERSION})
-
-# Find out the correct installation directory
-if (USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
- set(_TelepathyQtConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/TelepathyQt${QT_VERSION_MAJOR})
-else (USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
- set(_TelepathyQtConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/TelepathyQt${QT_VERSION_MAJOR}/cmake)
-endif (USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
+write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}ConfigVersion.cmake
+ VERSION ${PACKAGE_VERSION} COMPATIBILITY SameMajorVersion)
install(EXPORT TelepathyQt${QT_VERSION_MAJOR}Targets
DESTINATION ${_TelepathyQtConfig_INSTALL_DIR}
+ NAMESPACE TelepathyQt${QT_VERSION_MAJOR}::
COMPONENT headers)
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}ConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}Config.cmake
DESTINATION ${_TelepathyQtConfig_INSTALL_DIR}
@@ -854,66 +878,88 @@ if(ENABLE_SERVICE_SUPPORT)
# lets build tp-qt service side support as a separate library until we can guarantee API/ABI
# stability
set(telepathy_qt_service_SRCS
+ abstract-adaptor.cpp
+ base-call.cpp
+ base-channel.cpp
base-connection-manager.cpp
base-connection.cpp
- base-channel.cpp
+ base-debug.cpp
base-protocol.cpp
dbus-error.cpp
dbus-object.cpp
dbus-service.cpp
- abstract-adaptor.cpp)
+ io-device.cpp
+ )
set(telepathy_qt_service_HEADERS
AbstractAdaptor
- abstract-adaptor.h
AbstractDBusServiceInterface
AbstractProtocolInterface
- BaseConnectionManager
- base-connection-manager.h
- BaseConnection
- base-connection.h
+ BaseCall
BaseChannel
- base-channel.h
+ BaseConnection
+ BaseConnectionManager
+ BaseDebug
BaseProtocol
BaseProtocolAddressingInterface
BaseProtocolAvatarsInterface
BaseProtocolPresenceInterface
- base-protocol.h
DBusError
- dbus-error.h
DBusObject
- dbus-object.h
DBusService
- dbus-service.h
+ IODevice
ServiceTypes
- service-types.h)
+ abstract-adaptor.h
+ base-call.h
+ base-channel.h
+ base-connection-manager.h
+ base-connection.h
+ base-debug.h
+ base-protocol.h
+ dbus-error.h
+ dbus-object.h
+ dbus-service.h
+ io-device.h
+ service-types.h
+ )
# Generated headers which will be installed and exported
set(telepathy_qt_service_gen_HEADERS
+ ${CMAKE_CURRENT_BINARY_DIR}/_gen/svc-call.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/svc-channel.h
+ ${CMAKE_CURRENT_BINARY_DIR}/_gen/svc-connection-manager.h
${CMAKE_CURRENT_BINARY_DIR}/_gen/svc-connection.h
- ${CMAKE_CURRENT_BINARY_DIR}/_gen/svc-connection-manager.h)
+ )
# Headers file moc will be run on
set(telepathy_qt_service_MOC_SRCS
abstract-adaptor.h
- base-connection-manager.h
- base-connection-manager-internal.h
- base-channel.h
+ base-call-internal.h
+ base-call.h
base-channel-internal.h
- base-connection.h
+ base-channel.h
base-connection-internal.h
- base-protocol.h
+ base-connection-manager-internal.h
+ base-connection-manager.h
+ base-connection.h
+ base-debug-internal.h
+ base-debug.h
base-protocol-internal.h
+ base-protocol.h
dbus-object.h
- dbus-service.h)
+ dbus-service.h
+ io-device.h
+ )
add_custom_target(all-generated-service-sources)
set(SPECS
+ svc-call
svc-channel
svc-connection
- svc-connection-manager)
+ svc-connection-manager
+ svc-debug
+ )
foreach(spec ${SPECS})
tpqt_xincludator(${spec}-spec-xincludator ${CMAKE_CURRENT_SOURCE_DIR}/${spec}.xml ${CMAKE_CURRENT_BINARY_DIR}/_gen/spec-${spec}.xml
DEPENDS stable-typesgen)
@@ -924,15 +970,17 @@ if(ENABLE_SERVICE_SUPPORT)
list(APPEND telepathy_qt_service_SRCS ${NEW_FILES})
list(APPEND telepathy_qt_service_generated_specs_mocs "moc-${spec}.moc.hpp")
set_source_files_properties(${NEW_FILES} PROPERTIES GENERATED true)
- endforeach(spec ${SPECS})
+ endforeach()
tpqt_service_generator(svc-channel servicechannel Channel Tp::Service DEPENDS svc-channel-spec-xincludator)
+ tpqt_service_generator(svc-call servicecall Channel Tp::Service DEPENDS svc-call-spec-xincludator)
tpqt_service_generator(svc-connection serviceconn Connection Tp::Service DEPENDS svc-connection-spec-xincludator)
tpqt_service_generator(svc-connection-manager servicecm ConnectionManager Tp::Service DEPENDS svc-connection-manager-spec-xincludator)
+ tpqt_service_generator(svc-debug servicecm Debug Tp::Service DEPENDS svc-debug-spec-xincludator)
if (TARGET doxygen-doc)
add_dependencies(doxygen-doc all-generated-service-sources)
- endif (TARGET doxygen-doc)
+ endif ()
# Create the library
#if (ENABLE_COMPILER_COVERAGE)
@@ -940,8 +988,16 @@ if(ENABLE_SERVICE_SUPPORT)
#else (ENABLE_COMPILER_COVERAGE)
# add_library(telepathy-qt${QT_VERSION_MAJOR}-service SHARED ${telepathy_qt_service_SRCS})
#endif (ENABLE_COMPILER_COVERAGE)
- # lets build a static only library until we have a stable API/ABI
- add_library(telepathy-qt${QT_VERSION_MAJOR}-service STATIC ${telepathy_qt_service_SRCS})
+
+ if(FORCE_STATIC_SERVICE_LIBRARY)
+ set(SERVICE_LIBRARY_TYPE STATIC)
+ else()
+ set(SERVICE_LIBRARY_TYPE SHARED)
+ endif()
+
+ add_library(telepathy-qt${QT_VERSION_MAJOR}-service ${SERVICE_LIBRARY_TYPE} ${telepathy_qt_service_SRCS})
+ add_library(TelepathyQt${QT_VERSION_MAJOR}::Service ALIAS telepathy-qt${QT_VERSION_MAJOR}-service)
+ add_dependencies(telepathy-qt${QT_VERSION_MAJOR}-service stable-typesgen future-typesgen)
# generate service moc files
foreach(moc_src ${telepathy_qt_service_MOC_SRCS})
@@ -953,31 +1009,26 @@ if(ENABLE_SERVICE_SUPPORT)
list(APPEND telepathy_qt_service_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${generated_file})
string(REPLACE ".h" ".moc.hpp" moc_src ${moc_src})
add_dependencies(telepathy-qt${QT_VERSION_MAJOR}-service "moc-${moc_src}")
- endforeach(moc_src ${telepathy_qt_service_MOC_SRCS})
+ endforeach()
# Link
- target_link_libraries(telepathy-qt${QT_VERSION_MAJOR}-service
- ${QT_QTDBUS_LIBRARY}
- ${QT_QTCORE_LIBRARY}
- ${TP_QT_LIBRARY_LINKER_FLAGS})
+ target_link_libraries(telepathy-qt${QT_VERSION_MAJOR}-service PUBLIC
+ Qt5::Core
+ Qt5::DBus
+ telepathy-qt${QT_VERSION_MAJOR})
# Set the correct version number
set_target_properties(telepathy-qt${QT_VERSION_MAJOR}-service PROPERTIES
- SOVERSION ${TP_QT_ABI_VERSION}
+ EXPORT_NAME Service
+ SOVERSION ${TP_QT_SERVICE_ABI_VERSION}
VERSION ${TP_QT_LIBRARY_VERSION})
- # Install the library - watch out for the correct components
- if (WIN32)
- install(TARGETS telepathy-qt${QT_VERSION_MAJOR}-service
- EXPORT TelepathyQt${QT_VERSION_MAJOR}Targets
- RUNTIME DESTINATION ${LIB_INSTALL_DIR} COMPONENT service
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT service_libs)
- else (WIN32)
- install(TARGETS telepathy-qt${QT_VERSION_MAJOR}-service
- EXPORT TelepathyQt${QT_VERSION_MAJOR}Targets
- LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT service
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT service_libs)
- endif (WIN32)
+ # Install the library
+ install(TARGETS telepathy-qt${QT_VERSION_MAJOR}-service
+ EXPORT TelepathyQt${QT_VERSION_MAJOR}Targets
+ RUNTIME DESTINATION ${LIB_INSTALL_DIR} COMPONENT service
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT service
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT service_libs)
# Install headers
install(FILES ${telepathy_qt_service_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}/TelepathyQt
@@ -990,24 +1041,24 @@ if(ENABLE_SERVICE_SUPPORT)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQtService.pc.in ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}Service.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQtService-uninstalled.pc.in ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}Service-uninstalled.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}Service.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig COMPONENT pkgconfig)
- endif (NOT WIN32)
+ endif ()
+
+ set(_TelepathyQtServiceConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/TelepathyQt${QT_VERSION_MAJOR}Service)
# Configure the actual Config file
- configure_file(TelepathyQtServiceConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}ServiceConfig.cmake" @ONLY)
+ configure_package_config_file(TelepathyQtServiceConfig.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}ServiceConfig.cmake"
+ INSTALL_DESTINATION ${_TelepathyQtServiceConfig_INSTALL_DIR}
+ PATH_VARS CMAKE_INSTALL_PREFIX INCLUDE_INSTALL_DIR LIB_INSTALL_DIR
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO)
# this file is used by to check if the installed version can be used.
- macro_write_basic_cmake_version_file(${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}ServiceConfigVersion.cmake
- ${PACKAGE_VERSION})
-
- if(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
- set(_TelepathyQtServiceConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/TelepathyQt${QT_VERSION_MAJOR}Service)
- else(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
- set(_TelepathyQtServiceConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/TelepathyQt${QT_VERSION_MAJOR}Service/cmake)
- endif(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
+ write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}ServiceConfigVersion.cmake
+ VERSION ${PACKAGE_VERSION} COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}ServiceConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}ServiceConfig.cmake
DESTINATION ${_TelepathyQtServiceConfig_INSTALL_DIR}
COMPONENT headers)
-endif(ENABLE_SERVICE_SUPPORT)
+endif()
diff --git a/TelepathyQt/Farstream/CMakeLists.txt b/TelepathyQt/Farstream/CMakeLists.txt
index 250bfdb8..106daab3 100644
--- a/TelepathyQt/Farstream/CMakeLists.txt
+++ b/TelepathyQt/Farstream/CMakeLists.txt
@@ -2,16 +2,12 @@ if(FARSTREAM_COMPONENTS_FOUND)
include_directories(${TELEPATHY_FARSTREAM_INCLUDE_DIR}
${TELEPATHY_GLIB_INCLUDE_DIR}
${FARSTREAM_INCLUDE_DIR}
- ${GSTREAMER_INCLUDE_DIR}
+ ${GSTREAMER_INCLUDE_DIRS}
${GLIB2_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
+ ${DBUS_GLIB_INCLUDE_DIR}
${DBUS_INCLUDE_DIR})
- # It gets inherited from the previous directory, hence it has to be removed explicitely
- remove_definitions(-DBUILDING_TP_QT)
- # We are building Telepathy-Qt-Farstream
- add_definitions(-DBUILDING_TP_QT_FARSTREAM -DQT_NO_KEYWORDS)
-
set(telepathy_qt_farstream_SRCS
channel.cpp)
@@ -32,16 +28,23 @@ if(FARSTREAM_COMPONENTS_FOUND)
if (ENABLE_COMPILER_COVERAGE)
add_library(telepathy-qt${QT_VERSION_MAJOR}-farstream STATIC
${telepathy_qt_farstream_SRCS} ${telepathy_qt_farstream_MOC_SRCS})
- else (ENABLE_COMPILER_COVERAGE)
+ else ()
add_library(telepathy-qt${QT_VERSION_MAJOR}-farstream SHARED
${telepathy_qt_farstream_SRCS} ${telepathy_qt_farstream_MOC_SRCS})
- endif (ENABLE_COMPILER_COVERAGE)
+ endif ()
+ add_library(TelepathyQt${QT_VERSION_MAJOR}::Farstream ALIAS telepathy-qt${QT_VERSION_MAJOR}-farstream)
+
+ # We are building Telepathy-Qt-Farstream
+ target_compile_definitions(telepathy-qt${QT_VERSION_MAJOR}-farstream PRIVATE
+ BUILDING_TP_QT_FARSTREAM
+ QT_NO_KEYWORDS)
# Link
target_link_libraries(telepathy-qt${QT_VERSION_MAJOR}-farstream
- ${QT_QTDBUS_LIBRARY}
- ${QT_QTCORE_LIBRARY}
+ Qt5::Core
+ Qt5::DBus
${GOBJECT_LIBRARIES}
+ ${GLIB2_LIBRARIES}
${TELEPATHY_FARSTREAM_LIBRARIES}
${TELEPATHY_GLIB_LIBRARIES}
telepathy-qt${QT_VERSION_MAJOR}
@@ -49,25 +52,20 @@ if(FARSTREAM_COMPONENTS_FOUND)
if (ENABLE_COMPILER_COVERAGE)
target_link_libraries(telepathy-qt${QT_VERSION_MAJOR}-farstream gcov)
- endif (ENABLE_COMPILER_COVERAGE)
+ endif ()
# Set the correct version number
set_target_properties(telepathy-qt${QT_VERSION_MAJOR}-farstream PROPERTIES
+ EXPORT_NAME Farstream
SOVERSION ${TP_QT_ABI_VERSION}
VERSION ${TP_QT_LIBRARY_VERSION})
- # Install the library - watch out for the correct components
- if (WIN32)
- install(TARGETS telepathy-qt${QT_VERSION_MAJOR}-farstream
- EXPORT TelepathyQt${QT_VERSION_MAJOR}Targets
- RUNTIME DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream_libs)
- else (WIN32)
- install(TARGETS telepathy-qt${QT_VERSION_MAJOR}-farstream
- EXPORT TelepathyQt${QT_VERSION_MAJOR}Targets
- LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream_libs)
- endif (WIN32)
+ # Install the library
+ install(TARGETS telepathy-qt${QT_VERSION_MAJOR}-farstream
+ EXPORT TelepathyQt${QT_VERSION_MAJOR}Targets
+ RUNTIME DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream_libs)
# Install headers
install(FILES ${telepathy_qt_farstream_HEADERS}
@@ -82,25 +80,24 @@ if(FARSTREAM_COMPONENTS_FOUND)
${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}Farstream-uninstalled.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}Farstream.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig COMPONENT pkgconfig)
- endif (NOT WIN32)
+ endif ()
+
+ set(_TelepathyQtFarstreamConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/TelepathyQt${QT_VERSION_MAJOR}Farstream)
# Configure the actual Config file
- configure_file(TelepathyQtFarstreamConfig.cmake.in
- "${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}FarstreamConfig.cmake" @ONLY)
+ configure_package_config_file(TelepathyQtFarstreamConfig.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}FarstreamConfig.cmake"
+ INSTALL_DESTINATION ${_TelepathyQtFarstreamConfig_INSTALL_DIR}
+ PATH_VARS CMAKE_INSTALL_PREFIX INCLUDE_INSTALL_DIR LIB_INSTALL_DIR
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO)
# this file is used by to check if the installed version can be used.
- macro_write_basic_cmake_version_file(${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}FarstreamConfigVersion.cmake
- ${PACKAGE_VERSION})
-
- if(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
- set(_TelepathyQtFarstreamConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/TelepathyQt${QT_VERSION_MAJOR}Farstream)
- else(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
- set(_TelepathyQtFarstreamConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/TelepathyQt${QT_VERSION_MAJOR}Farstream/cmake)
- endif(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
+ write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}FarstreamConfigVersion.cmake
+ VERSION ${PACKAGE_VERSION} COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}FarstreamConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}FarstreamConfig.cmake
DESTINATION ${_TelepathyQtFarstreamConfig_INSTALL_DIR}
COMPONENT headers)
-endif(FARSTREAM_COMPONENTS_FOUND)
+endif()
diff --git a/TelepathyQt/Farstream/TelepathyQtFarstream-uninstalled.pc.in b/TelepathyQt/Farstream/TelepathyQtFarstream-uninstalled.pc.in
index 1c608ada..8861e361 100644
--- a/TelepathyQt/Farstream/TelepathyQtFarstream-uninstalled.pc.in
+++ b/TelepathyQt/Farstream/TelepathyQtFarstream-uninstalled.pc.in
@@ -6,6 +6,6 @@ abs_top_srcdir=${CMAKE_SOURCE_DIR}
Name: TelepathyQt${QT_VERSION_MAJOR}Farstream (uninstalled copy)
Description: Qt Telepathy Farstream utility library for the Telepathy framework
Version: ${PACKAGE_VERSION}
-Requires.private: QtCore >= ${QT_MIN_VERSION}, QtCore < ${QT_MAX_VERSION}, QtDBus >= ${QT_MIN_VERSION}, QtDBus < ${QT_MAX_VERSION}, telepathy-glib >= ${TELEPATHY_GLIB_MIN_VERSION}, telepathy-farstream >= ${TELEPATHY_FARSTREAM_MIN_VERSION}, TelepathyQt${QT_VERSION_MAJOR} = ${PACKAGE_VERSION}
+Requires.private: Qt${QT_VERSION_PC}Core >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}Core < ${QT_MAX_VERSION}, Qt${QT_VERSION_PC}DBus >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}DBus < ${QT_MAX_VERSION}, telepathy-glib >= ${TELEPATHY_GLIB_MIN_VERSION}, telepathy-farstream >= ${TELEPATHY_FARSTREAM_MIN_VERSION}, TelepathyQt${QT_VERSION_MAJOR} = ${PACKAGE_VERSION}
Libs: ${CMAKE_BINARY_DIR}/TelepathyQt${QT_VERSION_MAJOR}/Farstream/libtelepathy-qt${QT_VERSION_MAJOR}-farstream.so
Cflags: -I${CMAKE_SOURCE_DIR} -I${CMAKE_BINARY_DIR}
diff --git a/TelepathyQt/Farstream/TelepathyQtFarstream.pc.in b/TelepathyQt/Farstream/TelepathyQtFarstream.pc.in
index 1a66d6d8..ccebb472 100644
--- a/TelepathyQt/Farstream/TelepathyQtFarstream.pc.in
+++ b/TelepathyQt/Farstream/TelepathyQtFarstream.pc.in
@@ -6,6 +6,6 @@ includedir=${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}
Name: TelepathyQt${QT_VERSION_MAJOR}Farstream
Description: Qt Telepathy Farstream utility library for the Telepathy framework
Version: ${PACKAGE_VERSION}
-Requires.private: QtCore >= ${QT_MIN_VERSION}, QtCore < ${QT_MAX_VERSION}, QtDBus >= ${QT_MIN_VERSION}, QtDBus < ${QT_MAX_VERSION}, telepathy-glib >= ${TELEPATHY_GLIB_MIN_VERSION}, telepathy-farstream >= ${TELEPATHY_FARSTREAM_MIN_VERSION}, TelepathyQt${QT_VERSION_MAJOR} = ${PACKAGE_VERSION}
+Requires.private: Qt${QT_VERSION_PC}Core >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}Core < ${QT_MAX_VERSION}, Qt${QT_VERSION_PC}DBus >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}DBus < ${QT_MAX_VERSION}, telepathy-glib >= ${TELEPATHY_GLIB_MIN_VERSION}, telepathy-farstream >= ${TELEPATHY_FARSTREAM_MIN_VERSION}, TelepathyQt${QT_VERSION_MAJOR} = ${PACKAGE_VERSION}
Libs: -L${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR} -ltelepathy-qt${QT_VERSION_MAJOR}-farstream
Cflags: -I${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}
diff --git a/TelepathyQt/Farstream/TelepathyQtFarstreamConfig.cmake.in b/TelepathyQt/Farstream/TelepathyQtFarstreamConfig.cmake.in
index 9e401ced..47cca62c 100644
--- a/TelepathyQt/Farstream/TelepathyQtFarstreamConfig.cmake.in
+++ b/TelepathyQt/Farstream/TelepathyQtFarstreamConfig.cmake.in
@@ -2,6 +2,9 @@
# Any changed value in this file will be overwritten by CMake.
if(NOT TelepathyQt@QT_VERSION_MAJOR@Farstream_FOUND)
+
+ @PACKAGE_INIT@
+
# set the version number
set(TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_VERSION_MAJOR @TP_QT_MAJOR_VERSION@)
set(TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_VERSION_MINOR @TP_QT_MINOR_VERSION@)
@@ -11,14 +14,13 @@ if(NOT TelepathyQt@QT_VERSION_MAJOR@Farstream_FOUND)
# set the directories
if(NOT TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_INSTALL_DIR)
- set(TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@")
- endif(NOT TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_INSTALL_DIR)
+ set_and_check(TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_INSTALL_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@")
+ endif()
- set(TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_INCLUDE_DIR "@TELEPATHY_QT_INCLUDE_DIR@")
- set(TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_LIB_DIR "@TELEPATHY_QT_LIB_DIR@")
- set(TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_SHARE_DIR "@TELEPATHY_QT_DATA_DIR@")
+ set_and_check(TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@/telepathy-qt@QT_VERSION_MAJOR@")
+ set_and_check(TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@")
find_package(TelepathyQt@QT_VERSION_MAJOR@ REQUIRED)
set(TELEPATHY_QT@QT_VERSION_MAJOR@_FARSTREAM_LIBRARIES telepathy-qt@QT_VERSION_MAJOR@-farstream)
-endif(NOT TelepathyQt@QT_VERSION_MAJOR@Farstream_FOUND)
+endif()
diff --git a/TelepathyQt/Farstream/channel.cpp b/TelepathyQt/Farstream/channel.cpp
index 0cd54f9e..456d9aaf 100644
--- a/TelepathyQt/Farstream/channel.cpp
+++ b/TelepathyQt/Farstream/channel.cpp
@@ -42,7 +42,7 @@ namespace Farstream
struct TP_QT_FS_NO_EXPORT PendingChannel::Private
{
Private()
- : mTfChannel(0)
+ : mTfChannel(nullptr)
{
}
@@ -62,7 +62,7 @@ PendingChannel::PendingChannel(const CallChannelPtr &channel)
return;
}
- TpDBusDaemon *dbus = tp_dbus_daemon_dup(0);
+ TpDBusDaemon *dbus = tp_dbus_daemon_dup(nullptr);
if (!dbus) {
warning() << "Unable to connect to D-Bus";
setFinishedWithError(TP_QT_ERROR_NOT_AVAILABLE,
@@ -90,7 +90,7 @@ PendingChannel::PendingChannel(const CallChannelPtr &channel)
}
TpConnection *gconnection = tp_simple_client_factory_ensure_connection (factory,
- connection->objectPath().toLatin1(), NULL, 0);
+ connection->objectPath().toLatin1(), nullptr, nullptr);
if (!gconnection) {
warning() << "Unable to construct TpConnection";
setFinishedWithError(TP_QT_ERROR_NOT_AVAILABLE,
@@ -107,11 +107,11 @@ PendingChannel::PendingChannel(const CallChannelPtr &channel)
"object-path", channel->objectPath().toLatin1().constData(),
NULL);
g_object_unref(factory);
- factory = 0;
+ factory = nullptr;
g_object_unref(dbus);
- dbus = 0;
+ dbus = nullptr;
g_object_unref(gconnection);
- gconnection = 0;
+ gconnection = nullptr;
if (!gchannel) {
warning() << "Unable to construct TpChannel";
setFinishedWithError(TP_QT_ERROR_NOT_AVAILABLE,
@@ -133,7 +133,7 @@ void PendingChannel::Private::onTfChannelNewFinish(GObject *sourceObject,
{
PendingChannel *self = reinterpret_cast<PendingChannel *>(userData);
- GError *error = NULL;
+ GError *error = nullptr;
TfChannel *ret = tf_channel_new_finish(sourceObject, res, &error);
if (error) {
warning() << "Fs::PendingChannel::Private::onTfChannelNewFinish: error " << error->message;
diff --git a/TelepathyQt/Farstream/channel.h b/TelepathyQt/Farstream/channel.h
index 6ed6a023..09d60e4b 100644
--- a/TelepathyQt/Farstream/channel.h
+++ b/TelepathyQt/Farstream/channel.h
@@ -45,7 +45,7 @@ class TP_QT_FS_EXPORT PendingChannel : public Tp::PendingOperation
Q_DISABLE_COPY(PendingChannel)
public:
- ~PendingChannel();
+ ~PendingChannel() override;
TfChannel *tfChannel() const;
CallChannelPtr callChannel() const;
diff --git a/TelepathyQt/IODevice b/TelepathyQt/IODevice
new file mode 100644
index 00000000..7a6b5664
--- /dev/null
+++ b/TelepathyQt/IODevice
@@ -0,0 +1,13 @@
+#ifndef _TelepathyQt_IODevice_HEADER_GUARD_
+#define _TelepathyQt_IODevice_HEADER_GUARD_
+
+#ifndef IN_TP_QT_HEADER
+#define IN_TP_QT_HEADER
+#endif
+
+#include <TelepathyQt/io-device.h>
+
+#undef IN_TP_QT_HEADER
+
+#endif // _TelepathyQt_IODevice_HEADER_GUARD_
+// vim:set ft=cpp:
diff --git a/TelepathyQt/TelepathyQt.pc.in b/TelepathyQt/TelepathyQt.pc.in
index d245fed9..5062e4e9 100644
--- a/TelepathyQt/TelepathyQt.pc.in
+++ b/TelepathyQt/TelepathyQt.pc.in
@@ -1,11 +1,9 @@
-prefix=${CMAKE_INSTALL_PREFIX}
-exec_prefix=${CMAKE_INSTALL_PREFIX}
-libdir=${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}
-includedir=${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}
+libdir=${LIB_INSTALL_DIR}
+includedir=${INCLUDE_INSTALL_DIR}
Name: TelepathyQt${QT_VERSION_MAJOR}
Description: Qt utility library for the Telepathy framework
Version: ${PACKAGE_VERSION}
Requires.private: Qt${QT_VERSION_PC}Core >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}Core < ${QT_MAX_VERSION}, Qt${QT_VERSION_PC}DBus >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}DBus < ${QT_MAX_VERSION}, Qt${QT_VERSION_PC}Network >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}Network < ${QT_MAX_VERSION}, Qt${QT_VERSION_PC}Xml >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}Xml < ${QT_MAX_VERSION}
-Libs: -L${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR} -ltelepathy-qt${QT_VERSION_MAJOR}
-Cflags: -I${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}
+Libs: -L${LIB_INSTALL_DIR} -ltelepathy-qt${QT_VERSION_MAJOR}
+Cflags: -I${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}
diff --git a/TelepathyQt/TelepathyQtConfig.cmake.in b/TelepathyQt/TelepathyQtConfig.cmake.in
index c4e604c8..5f5845ae 100644
--- a/TelepathyQt/TelepathyQtConfig.cmake.in
+++ b/TelepathyQt/TelepathyQtConfig.cmake.in
@@ -2,6 +2,9 @@
# Any changed value in this file will be overwritten by CMake.
if(NOT TelepathyQt@QT_VERSION_MAJOR@_FOUND)
+
+ @PACKAGE_INIT@
+
# set the version number
set(TELEPATHY_QT@QT_VERSION_MAJOR@_VERSION_MAJOR @TP_QT_MAJOR_VERSION@)
set(TELEPATHY_QT@QT_VERSION_MAJOR@_VERSION_MINOR @TP_QT_MINOR_VERSION@)
@@ -9,20 +12,76 @@ if(NOT TelepathyQt@QT_VERSION_MAJOR@_FOUND)
set(TELEPATHY_QT@QT_VERSION_MAJOR@_VERSION_NANO @TP_QT_NANO_VERSION@)
set(TELEPATHY_QT@QT_VERSION_MAJOR@_VERSION @PACKAGE_VERSION@)
- # set the directories
- if(NOT TELEPATHY_QT@QT_VERSION_MAJOR@_INSTALL_DIR)
- set(TELEPATHY_QT@QT_VERSION_MAJOR@_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@")
- endif(NOT TELEPATHY_QT@QT_VERSION_MAJOR@_INSTALL_DIR)
+ # Find the dependencies
+ include(CMakeFindDependencyMacro)
+
+ # Base Qt components set
+ set(_QT_COMPONENTS Core DBus Network)
- set(TELEPATHY_QT@QT_VERSION_MAJOR@_INCLUDE_DIR "@TELEPATHY_QT_INCLUDE_DIR@")
- set(TELEPATHY_QT@QT_VERSION_MAJOR@_LIB_DIR "@TELEPATHY_QT_LIB_DIR@")
- set(TELEPATHY_QT@QT_VERSION_MAJOR@_SHARE_DIR "@TELEPATHY_QT_DATA_DIR@")
+ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.9)
+ find_dependency(Qt5 @QT_MINUMUM_VERSION@ COMPONENTS ${_QT_COMPONENTS})
+ else()
+ # Old CMake versions do not support COMPONENTS in find_dependency
+ foreach(_QT_MODULE ${_QT_COMPONENTS})
+ find_dependency(Qt5${_QT_MODULE} @QT_MINUMUM_VERSION@)
+ endforeach()
+ endif()
+ unset(_QT_COMPONENTS)
- # attempt to find the generated TelepathyQt4Targets.cmake in the same directory
+ # attempt to find the generated Targets file in the same directory
get_filename_component(_TPQT@QT_VERSION_MAJOR@_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
find_file(_TPQT@QT_VERSION_MAJOR@_TARGETS_FILE TelepathyQt@QT_VERSION_MAJOR@Targets.cmake PATHS ${_TPQT@QT_VERSION_MAJOR@_CONFIG_DIR} NO_DEFAULT_PATH)
- # set the TELEPATHY_QT@QT_VERSION_MAJOR@_LIBRARIES variable
include(${_TPQT@QT_VERSION_MAJOR@_TARGETS_FILE})
- set(TELEPATHY_QT@QT_VERSION_MAJOR@_LIBRARIES telepathy-qt@QT_VERSION_MAJOR@)
-endif(NOT TelepathyQt@QT_VERSION_MAJOR@_FOUND)
+
+ set(_TelepathyQt@QT_VERSION_MAJOR@_NOTFOUND_MESSAGE)
+ set(_WANTED_COMPONENTS "${TelepathyQt@QT_VERSION_MAJOR@_FIND_COMPONENTS}")
+ list (FIND _WANTED_COMPONENTS "Core" _CORE_INDEX)
+ if (${_CORE_INDEX} LESS 0)
+ list(APPEND _WANTED_COMPONENTS Core)
+ endif()
+ foreach(_MODULE ${_WANTED_COMPONENTS})
+ if(NOT TARGET TelepathyQt@QT_VERSION_MAJOR@::${_MODULE})
+ if (TelepathyQt@QT_VERSION_MAJOR@_FIND_REQUIRED_${_MODULE})
+ set(_TelepathyQt@QT_VERSION_MAJOR@_NOTFOUND_MESSAGE
+ "${_TelepathyQt@QT_VERSION_MAJOR@_NOTFOUND_MESSAGE}Failed to find TelepathyQt@QT_VERSION_MAJOR@ component \"${_MODULE}\"\n")
+ elseif(NOT TelepathyQt@QT_VERSION_MAJOR@_FIND_QUIETLY)
+ message(WARNING "Failed to find TelepathyQt@QT_VERSION_MAJOR@ component \"${_MODULE}\"")
+ endif()
+ endif()
+ endforeach()
+
+ if (_TelepathyQt@QT_VERSION_MAJOR@_NOTFOUND_MESSAGE)
+ set(TelepathyQt@QT_VERSION_MAJOR@_NOT_FOUND_MESSAGE "${_TelepathyQt@QT_VERSION_MAJOR@_NOTFOUND_MESSAGE}")
+ set(TelepathyQt@QT_VERSION_MAJOR@_FOUND False)
+ endif()
+
+ # Legacy stuff for old-style import
+
+ # set the LIBRARIES variable
+ get_target_property(TELEPATHY_QT@QT_VERSION_MAJOR@_LIBRARIES
+ TelepathyQt@QT_VERSION_MAJOR@::Core
+ IMPORTED_LOCATION
+ )
+
+ if(NOT TELEPATHY_QT@QT_VERSION_MAJOR@_LIBRARIES)
+ # If there is no default IMPORTED_LOCATION then get all configurations...
+ get_target_property(_IMPORTED_CONFIGURATIONS
+ TelepathyQt@QT_VERSION_MAJOR@::Core
+ IMPORTED_CONFIGURATIONS
+ )
+ # ... and pick up the first one
+ list(GET _IMPORTED_CONFIGURATIONS 0 _SELECTED_CONFIGURATION)
+ get_target_property(TELEPATHY_QT@QT_VERSION_MAJOR@_LIBRARIES
+ TelepathyQt@QT_VERSION_MAJOR@::Core
+ IMPORTED_LOCATION_${_SELECTED_CONFIGURATION}
+ )
+ unset(_IMPORTED_CONFIGURATIONS)
+ unset(_SELECTED_CONFIGURATION)
+ endif()
+
+ get_target_property(TELEPATHY_QT@QT_VERSION_MAJOR@_INCLUDE_DIR
+ TelepathyQt@QT_VERSION_MAJOR@::Core
+ INTERFACE_INCLUDE_DIRECTORIES
+ )
+endif()
diff --git a/TelepathyQt/TelepathyQtService-uninstalled.pc.in b/TelepathyQt/TelepathyQtService-uninstalled.pc.in
index 2a4b0bc1..01cd1ba5 100644
--- a/TelepathyQt/TelepathyQtService-uninstalled.pc.in
+++ b/TelepathyQt/TelepathyQtService-uninstalled.pc.in
@@ -6,6 +6,6 @@ abs_top_srcdir=${CMAKE_SOURCE_DIR}
Name: TelepathyQt${QT_VERSION_MAJOR}Service (uninstalled copy)
Description: Qt Telepathy Service side bindings
Version: ${PACKAGE_VERSION}
-Requires.private: QtCore >= ${QT_MIN_VERSION}, QtCore < ${QT_MAX_VERSION}, QtDBus >= ${QT_MIN_VERSION}, QtDBus < ${QT_MAX_VERSION}, TelepathyQt${QT_VERSION_MAJOR} = ${PACKAGE_VERSION}
+Requires.private: Qt${QT_VERSION_PC}Core >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}Core < ${QT_MAX_VERSION}, Qt${QT_VERSION_PC}DBus >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}DBus < ${QT_MAX_VERSION}, TelepathyQt${QT_VERSION_MAJOR} = ${PACKAGE_VERSION}
Libs: ${CMAKE_BINARY_DIR}/TelepathyQt/Farsight/libtelepathy-qt${QT_VERSION_MAJOR}-service.so
Cflags: -I${CMAKE_SOURCE_DIR} -I${CMAKE_BINARY_DIR}
diff --git a/TelepathyQt/TelepathyQtService.pc.in b/TelepathyQt/TelepathyQtService.pc.in
index c5796654..d3485dc6 100644
--- a/TelepathyQt/TelepathyQtService.pc.in
+++ b/TelepathyQt/TelepathyQtService.pc.in
@@ -1,11 +1,9 @@
-prefix=${CMAKE_INSTALL_PREFIX}
-exec_prefix=${CMAKE_INSTALL_PREFIX}
-libdir=${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}
-includedir=${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}
+libdir=${LIB_INSTALL_DIR}
+includedir=${INCLUDE_INSTALL_DIR}
Name: TelepathyQt${QT_VERSION_MAJOR}Service
Description: Qt Telepathy Service side bindings
Version: ${PACKAGE_VERSION}
Requires.private: Qt${QT_VERSION_PC}Core >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}Core < ${QT_MAX_VERSION}, Qt${QT_VERSION_PC}DBus >= ${QT_MIN_VERSION}, Qt${QT_VERSION_PC}DBus < ${QT_MAX_VERSION}, TelepathyQt${QT_VERSION_MAJOR} = ${PACKAGE_VERSION}
-Libs: -L${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR} -ltelepathy-qt${QT_VERSION_MAJOR}-service
-Cflags: -I${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}
+Libs: -L${LIB_INSTALL_DIR} -ltelepathy-qt${QT_VERSION_MAJOR}-service
+Cflags: -I${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}
diff --git a/TelepathyQt/TelepathyQtServiceConfig.cmake.in b/TelepathyQt/TelepathyQtServiceConfig.cmake.in
index 06051355..17666c5a 100644
--- a/TelepathyQt/TelepathyQtServiceConfig.cmake.in
+++ b/TelepathyQt/TelepathyQtServiceConfig.cmake.in
@@ -1,6 +1,8 @@
# TelepathyQt@QT_VERSION_MAJOR@ServiceConfig.cmake is generated by CMake from TelepathyQt/TelepathyQtServiceConfig.cmake.in.
# Any changed value in this file will be overwritten by CMake.
+@PACKAGE_INIT@
+
# set the version number
set(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_VERSION_MAJOR @TP_QT_MAJOR_VERSION@)
set(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_VERSION_MINOR @TP_QT_MINOR_VERSION@)
@@ -8,15 +10,38 @@ set(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_VERSION_MICRO @TP_QT_MICRO_VERSION@)
set(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_VERSION_NANO @TP_QT_NANO_VERSION@)
set(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_VERSION @PACKAGE_VERSION@)
-# set the directories
-if(NOT TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_INSTALL_DIR)
- set(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@")
-endif(NOT TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_INSTALL_DIR)
+# Find the dependencies
+include(CMakeFindDependencyMacro)
-set(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_INCLUDE_DIR "@TELEPATHY_QT_INCLUDE_DIR@")
-set(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_LIB_DIR "@TELEPATHY_QT_LIB_DIR@")
-set(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_SHARE_DIR "@TELEPATHY_QT_DATA_DIR@")
+find_dependency(TelepathyQt@QT_VERSION_MAJOR@)
+
+# set the directories
+if(TARGET TelepathyQt@QT_VERSION_MAJOR@::Service)
+ # set the LIBRARIES variable
+ get_target_property(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_LIBRARIES
+ TelepathyQt@QT_VERSION_MAJOR@::Service
+ IMPORTED_LOCATION
+ )
-find_package(TelepathyQt@QT_VERSION_MAJOR@ REQUIRED)
+ if(NOT TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_LIBRARIES)
+ # If there is no default IMPORTED_LOCATION then get all configurations...
+ get_target_property(_IMPORTED_CONFIGURATIONS
+ TelepathyQt@QT_VERSION_MAJOR@::Service
+ IMPORTED_CONFIGURATIONS
+ )
+ # ... and pick up the first one
+ list(GET _IMPORTED_CONFIGURATIONS 0 _SELECTED_CONFIGURATION)
+ get_target_property(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_LIBRARIES
+ TelepathyQt@QT_VERSION_MAJOR@::Service
+ IMPORTED_LOCATION_${_SELECTED_CONFIGURATION}
+ )
+ unset(_IMPORTED_CONFIGURATIONS)
+ unset(_SELECTED_CONFIGURATION)
+ endif()
-set(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_LIBRARIES telepathy-qt@QT_VERSION_MAJOR@-service)
+ message(STATUS "TELEPATHY_QT_SERVICE_LIBRARIES Libs: ${TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_LIBRARIES}")
+ get_target_property(TELEPATHY_QT@QT_VERSION_MAJOR@_SERVICE_INCLUDE_DIR
+ TelepathyQt@QT_VERSION_MAJOR@::Service
+ INTERFACE_INCLUDE_DIRECTORIES
+ )
+endif()
diff --git a/TelepathyQt/abstract-adaptor.h b/TelepathyQt/abstract-adaptor.h
index 52601e39..43410b14 100644
--- a/TelepathyQt/abstract-adaptor.h
+++ b/TelepathyQt/abstract-adaptor.h
@@ -43,7 +43,7 @@ class TP_QT_EXPORT AbstractAdaptor : public QDBusAbstractAdaptor
public:
AbstractAdaptor(const QDBusConnection &connection, QObject *adaptee, QObject *parent);
- ~AbstractAdaptor();
+ ~AbstractAdaptor() override;
QDBusConnection dbusConnection() const;
diff --git a/TelepathyQt/abstract-client.cpp b/TelepathyQt/abstract-client.cpp
index b504bd0c..d504d45c 100644
--- a/TelepathyQt/abstract-client.cpp
+++ b/TelepathyQt/abstract-client.cpp
@@ -906,11 +906,6 @@ AbstractClientHandler::Capabilities AbstractClientHandler::handlerCapabilities()
* \param account The account with which the channels are associated.
* \param connection The connection with which the channels are associated.
* \param channels The channels to be handled.
- * \param dispatchOperation The dispatch operation for these channels.
- * The object will be invalid (DBusProxy::isValid()
- * will be false) if there is no dispatch
- * operation in place (because the channels were
- * requested, not incoming).
* \param requestsSatisfied The requests satisfied by these channels.
* \param userActionTime The time at which user action occurred, or 0 if this
* channel is to be handled for some reason not involving
diff --git a/TelepathyQt/abstract-client.h b/TelepathyQt/abstract-client.h
index 7658489c..8ef44dde 100644
--- a/TelepathyQt/abstract-client.h
+++ b/TelepathyQt/abstract-client.h
@@ -49,7 +49,7 @@ class TP_QT_EXPORT AbstractClient : public RefCounted
public:
AbstractClient();
- virtual ~AbstractClient();
+ ~AbstractClient() override;
bool isRegistered() const;
@@ -86,7 +86,7 @@ public:
QSharedDataPointer<Private> mPriv;
};
- virtual ~AbstractClientObserver();
+ ~AbstractClientObserver() override;
ChannelClassSpecList observerFilter() const;
@@ -114,7 +114,7 @@ class TP_QT_EXPORT AbstractClientApprover : public virtual AbstractClient
Q_DISABLE_COPY(AbstractClientApprover)
public:
- virtual ~AbstractClientApprover();
+ ~AbstractClientApprover() override;
ChannelClassSpecList approverFilter() const;
@@ -286,7 +286,7 @@ public:
QSharedDataPointer<Private> mPriv;
};
- virtual ~AbstractClientHandler();
+ ~AbstractClientHandler() override;
ChannelClassSpecList handlerFilter() const;
@@ -320,8 +320,8 @@ private:
} // Tp
-Q_DECLARE_METATYPE(Tp::AbstractClientObserver::ObserverInfo);
-Q_DECLARE_METATYPE(Tp::AbstractClientHandler::Capabilities);
-Q_DECLARE_METATYPE(Tp::AbstractClientHandler::HandlerInfo);
+Q_DECLARE_METATYPE(Tp::AbstractClientObserver::ObserverInfo)
+Q_DECLARE_METATYPE(Tp::AbstractClientHandler::Capabilities)
+Q_DECLARE_METATYPE(Tp::AbstractClientHandler::HandlerInfo)
#endif
diff --git a/TelepathyQt/abstract-interface.h b/TelepathyQt/abstract-interface.h
index fd735edd..06a91c08 100644
--- a/TelepathyQt/abstract-interface.h
+++ b/TelepathyQt/abstract-interface.h
@@ -45,7 +45,7 @@ class TP_QT_EXPORT AbstractInterface : public QDBusAbstractInterface
Q_DISABLE_COPY(AbstractInterface)
public:
- virtual ~AbstractInterface();
+ ~AbstractInterface() override;
bool isValid() const;
QString invalidationReason() const;
diff --git a/TelepathyQt/account-factory.h b/TelepathyQt/account-factory.h
index cb59f129..589595c4 100644
--- a/TelepathyQt/account-factory.h
+++ b/TelepathyQt/account-factory.h
@@ -51,7 +51,7 @@ public:
static AccountFactoryPtr create(const QDBusConnection &bus,
const Features &features = Features());
- virtual ~AccountFactory();
+ ~AccountFactory() override;
PendingReady *proxy(const QString &busName, const QString &objectPath,
const ConnectionFactoryConstPtr &connFactory,
@@ -65,7 +65,7 @@ protected:
const ConnectionFactoryConstPtr &connFactory,
const ChannelFactoryConstPtr &chanFactory,
const ContactFactoryConstPtr &contactFactory) const;
- virtual QString finalBusNameFrom(const QString &uniqueOrWellKnown) const;
+ QString finalBusNameFrom(const QString &uniqueOrWellKnown) const override;
// Nothing we'd like to prepare()
// Fixed features
diff --git a/TelepathyQt/account-manager.h b/TelepathyQt/account-manager.h
index 01dc161f..39b00e57 100644
--- a/TelepathyQt/account-manager.h
+++ b/TelepathyQt/account-manager.h
@@ -76,7 +76,7 @@ public:
const ContactFactoryConstPtr &contactFactory =
ContactFactory::create());
- virtual ~AccountManager();
+ ~AccountManager() override;
AccountFactoryConstPtr accountFactory() const;
ConnectionFactoryConstPtr connectionFactory() const;
diff --git a/TelepathyQt/account-property-filter.h b/TelepathyQt/account-property-filter.h
index 5694831e..ae98134c 100644
--- a/TelepathyQt/account-property-filter.h
+++ b/TelepathyQt/account-property-filter.h
@@ -42,9 +42,9 @@ public:
return AccountPropertyFilterPtr(new AccountPropertyFilter);
}
- ~AccountPropertyFilter();
+ ~AccountPropertyFilter() override;
- bool isValid() const;
+ bool isValid() const override;
private:
AccountPropertyFilter();
diff --git a/TelepathyQt/account-set-internal.h b/TelepathyQt/account-set-internal.h
index f7dbf9e0..2f4bde39 100644
--- a/TelepathyQt/account-set-internal.h
+++ b/TelepathyQt/account-set-internal.h
@@ -58,8 +58,8 @@ class TP_QT_NO_EXPORT AccountSet::Private::AccountWrapper : public QObject
Q_OBJECT
public:
- AccountWrapper(const AccountPtr &account, QObject *parent = 0);
- ~AccountWrapper();
+ AccountWrapper(const AccountPtr &account, QObject *parent = nullptr);
+ ~AccountWrapper() override;
AccountPtr account() const { return mAccount; }
diff --git a/TelepathyQt/account-set.h b/TelepathyQt/account-set.h
index 40dd79af..da9782c6 100644
--- a/TelepathyQt/account-set.h
+++ b/TelepathyQt/account-set.h
@@ -51,7 +51,7 @@ public:
const AccountFilterConstPtr &filter);
AccountSet(const AccountManagerPtr &accountManager,
const QVariantMap &filter);
- virtual ~AccountSet();
+ ~AccountSet() override;
AccountManagerPtr accountManager() const;
diff --git a/TelepathyQt/account.cpp b/TelepathyQt/account.cpp
index 52025a4c..d109c015 100644
--- a/TelepathyQt/account.cpp
+++ b/TelepathyQt/account.cpp
@@ -291,75 +291,16 @@ QVariantMap streamedMediaVideoCallRequest(const Tp::ContactPtr &contact, bool wi
return request;
}
-QVariantMap fileTransferCommonRequest(const Tp::FileTransferChannelCreationProperties &properties)
-{
- if (!properties.isValid()) {
- warning() << "Invalid file transfer creation properties";
- return QVariantMap();
- }
-
- QVariantMap request;
- request.insert(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"),
- TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER);
- request.insert(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType"),
- (uint) Tp::HandleTypeContact);
-
- request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Filename"),
- properties.suggestedFileName());
- request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentType"),
- properties.contentType());
- request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Size"),
- properties.size());
-
- if (properties.hasContentHash()) {
- request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentHashType"),
- (uint) properties.contentHashType());
- request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentHash"),
- properties.contentHash());
- }
-
- if (properties.hasDescription()) {
- request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Description"),
- properties.description());
- }
-
- if (properties.hasLastModificationTime()) {
- request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Date"),
- (qulonglong) properties.lastModificationTime().toTime_t());
- }
-
- if (properties.hasUri()) {
- request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".URI"),
- properties.uri());
- }
-
- return request;
-}
-
QVariantMap fileTransferRequest(const QString &contactIdentifier,
const Tp::FileTransferChannelCreationProperties &properties)
{
- QVariantMap request = fileTransferCommonRequest(properties);
-
- if (!request.isEmpty()) {
- request.insert(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetID"),
- contactIdentifier);
- }
-
- return request;
+ return properties.createRequest(contactIdentifier);
}
QVariantMap fileTransferRequest(const Tp::ContactPtr &contact,
const Tp::FileTransferChannelCreationProperties &properties)
{
- QVariantMap request = fileTransferCommonRequest(properties);
-
- if (!request.isEmpty()) {
- request.insert(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle"),
- contact ? contact->handle().at(0) : (uint) 0);
- }
-
- return request;
+ return properties.createRequest(contact ? contact->handle().at(0) : (uint) 0);
}
QVariantMap streamTubeCommonRequest(const QString &service)
@@ -449,7 +390,7 @@ QVariantMap conferenceCommonRequest(const QString &channelType, Tp::HandleType t
}
request.insert(TP_QT_IFACE_CHANNEL_INTERFACE_CONFERENCE + QLatin1String(".InitialChannels"),
- qVariantFromValue(objectPaths));
+ QVariant::fromValue(objectPaths));
return request;
}
@@ -478,7 +419,7 @@ QVariantMap conferenceRequest(const QString &channelType, Tp::HandleType targetH
}
if (!handles.isEmpty()) {
request.insert(TP_QT_IFACE_CHANNEL_INTERFACE_CONFERENCE +
- QLatin1String(".InitialInviteeHandles"), qVariantFromValue(handles));
+ QLatin1String(".InitialInviteeHandles"), QVariant::fromValue(handles));
}
}
return request;
@@ -536,6 +477,22 @@ QVariantMap conferenceStreamedMediaCallRequest(const QList<Tp::ChannelPtr> &chan
return request;
}
+QVariantMap conferenceCallRequest(const QList<Tp::ChannelPtr> &channels,
+ const QStringList &initialInviteeContactsIdentifiers)
+{
+ QVariantMap request = conferenceRequest(TP_QT_IFACE_CHANNEL_TYPE_CALL,
+ Tp::HandleTypeNone, channels, initialInviteeContactsIdentifiers);
+ return request;
+}
+
+QVariantMap conferenceCallRequest(const QList<Tp::ChannelPtr> &channels,
+ const QList<Tp::ContactPtr> &initialInviteeContacts)
+{
+ QVariantMap request = conferenceRequest(TP_QT_IFACE_CHANNEL_TYPE_CALL,
+ Tp::HandleTypeNone, channels, initialInviteeContacts);
+ return request;
+}
+
QVariantMap contactSearchRequest(const ConnectionCapabilities &capabilities,
const QString &server, uint limit)
{
@@ -2989,6 +2946,75 @@ PendingChannelRequest *Account::createConferenceStreamedMediaCall(
}
/**
+ * Start a request to create a conference call with the given
+ * channels \a channels.
+ *
+ * \param channels The conference channels.
+ * \param initialInviteeContactsIdentifiers A list of additional contacts
+ * identifiers to be invited to this
+ * conference when it is created.
+ * \param userActionTime The time at which user action occurred, or QDateTime()
+ * if this channel request is for some reason not
+ * involving user action.
+ * \param preferredHandler Either the well-known bus name (starting with
+ * org.freedesktop.Telepathy.Client.) of the preferred
+ * handler for this channel, or an empty string to
+ * indicate that any handler would be acceptable.
+ * \param hints Arbitrary metadata which will be relayed to the handler if supported,
+ * as indicated by supportsRequestHints().
+ * \return A PendingChannelRequest which will emit PendingChannelRequest::finished
+ * when the request has been made.
+ * \sa ensureChannel(), createChannel()
+ */
+PendingChannelRequest *Account::createConferenceCall(
+ const QList<ChannelPtr> &channels,
+ const QStringList &initialInviteeContactsIdentifiers,
+ const QDateTime &userActionTime,
+ const QString &preferredHandler,
+ const ChannelRequestHints &hints)
+{
+ QVariantMap request = conferenceCallRequest(channels,
+ initialInviteeContactsIdentifiers);
+
+ return new PendingChannelRequest(AccountPtr(this), request, userActionTime,
+ preferredHandler, true, hints);
+}
+
+/**
+ * Start a request to create a conference call with the given
+ * channels \a channels.
+ *
+ * \param channels The conference channels.
+ * \param initialInviteeContacts A list of additional contacts
+ * to be invited to this
+ * conference when it is created.
+ * \param userActionTime The time at which user action occurred, or QDateTime()
+ * if this channel request is for some reason not
+ * involving user action.
+ * \param preferredHandler Either the well-known bus name (starting with
+ * org.freedesktop.Telepathy.Client.) of the preferred
+ * handler for this channel, or an empty string to
+ * indicate that any handler would be acceptable.
+ * \param hints Arbitrary metadata which will be relayed to the handler if supported,
+ * as indicated by supportsRequestHints().
+ * \return A PendingChannelRequest which will emit PendingChannelRequest::finished
+ * when the request has been made.
+ * \sa ensureChannel(), createChannel()
+ */
+PendingChannelRequest *Account::createConferenceCall(
+ const QList<ChannelPtr> &channels,
+ const QList<ContactPtr> &initialInviteeContacts,
+ const QDateTime &userActionTime,
+ const QString &preferredHandler,
+ const ChannelRequestHints &hints)
+{
+ QVariantMap request = conferenceCallRequest(channels, initialInviteeContacts);
+
+ return new PendingChannelRequest(AccountPtr(this), request, userActionTime,
+ preferredHandler, true, hints);
+}
+
+/**
* Start a request to create a conference text chat with the given
* channels \a channels.
*
@@ -3131,6 +3157,63 @@ PendingChannelRequest *Account::createConferenceTextChatroom(
}
/**
+ * Start a request to create a conference call with the given
+ * channels \a channels.
+ * This initially just creates a PendingChannel object,
+ * which can be used to track the success or failure of the request.
+ *
+ * \param channels The conference channels.
+ * \param initialInviteeContactsIdentifiers A list of additional contacts
+ * identifiers to be invited to this
+ * conference when it is created.
+ * \param userActionTime The time at which user action occurred, or QDateTime()
+ * if this channel request is for some reason not
+ * involving user action.
+ * \return A PendingChannel which will emit PendingChannel::finished
+ * successfully, when the Channel is available for handling using
+ * PendingChannel::channel(), or with an error if one has been encountered.
+ * \sa ensureAndHandleChannel(), createAndHandleChannel()
+ */
+PendingChannel *Account::createAndHandleConferenceCall(
+ const QList<ChannelPtr> &channels,
+ const QStringList &initialInviteeContactsIdentifiers,
+ const QDateTime &userActionTime)
+{
+ QVariantMap request = conferenceCallRequest(channels,
+ initialInviteeContactsIdentifiers);
+
+ return createAndHandleChannel(request, userActionTime);
+}
+
+/**
+ * Start a request to create a conference call with the given
+ * channels \a channels.
+ * This initially just creates a PendingChannel object,
+ * which can be used to track the success or failure of the request.
+ *
+ * \param channels The conference channels.
+ * \param initialInviteeContacts A list of additional contacts
+ * to be invited to this
+ * conference when it is created.
+ * \param userActionTime The time at which user action occurred, or QDateTime()
+ * if this channel request is for some reason not
+ * involving user action.
+ * \return A PendingChannel which will emit PendingChannel::finished
+ * successfully, when the Channel is available for handling using
+ * PendingChannel::channel(), or with an error if one has been encountered.
+ * \sa ensureAndHandleChannel(), createAndHandleChannel()
+ */
+PendingChannel *Account::createAndHandleConferenceCall(
+ const QList<ChannelPtr> &channels,
+ const QList<ContactPtr> &initialInviteeContacts,
+ const QDateTime &userActionTime)
+{
+ QVariantMap request = conferenceCallRequest(channels, initialInviteeContacts);
+
+ return createAndHandleChannel(request, userActionTime);
+}
+
+/**
* Start a request to create a contact search channel with the given
* server \a server and limit \a limit.
*
@@ -3717,7 +3800,7 @@ PendingChannel *Account::createAndHandleDBusTube(
* which can be used to track the success or failure of the request.
*
* \param contact The contact to open a DBus tube with.
- * \param service The DBus tube service name.
+ * \param serviceName The DBus tube service name.
* \param userActionTime The time at which user action occurred, or QDateTime()
* if this channel request is for some reason not
* involving user action.
@@ -4116,7 +4199,7 @@ void Account::Private::init()
void Account::Private::introspectMain(Account::Private *self)
{
if (self->dispatcherContext->introspected) {
- self->parent->onDispatcherIntrospected(0);
+ self->parent->onDispatcherIntrospected(nullptr);
return;
}
@@ -4495,7 +4578,7 @@ void Account::onDispatcherIntrospected(Tp::PendingOperation *op)
{
if (!mPriv->dispatcherContext->introspected) {
Tp::PendingVariant *pv = static_cast<Tp::PendingVariant *>(op);
- Q_ASSERT(pv != NULL);
+ Q_ASSERT(pv != nullptr);
// Only the first Account for a given dispatcher will enter this branch, and will
// immediately make further created accounts skip the whole waiting for CD to get
@@ -4646,7 +4729,7 @@ void Account::onRemoved()
void Account::onConnectionBuilt(PendingOperation *op)
{
PendingReady *readyOp = qobject_cast<PendingReady *>(op);
- Q_ASSERT(readyOp != NULL);
+ Q_ASSERT(readyOp != nullptr);
if (op->isError()) {
warning() << "Building connection" << mPriv->connObjPathQueue.head() << "failed with" <<
diff --git a/TelepathyQt/account.h b/TelepathyQt/account.h
index 72f858f5..7563e882 100644
--- a/TelepathyQt/account.h
+++ b/TelepathyQt/account.h
@@ -119,7 +119,7 @@ public:
const ChannelFactoryConstPtr &channelFactory,
const ContactFactoryConstPtr &contactFactory =
ContactFactory::create());
- virtual ~Account();
+ ~Account() override;
ConnectionFactoryConstPtr connectionFactory() const;
ChannelFactoryConstPtr channelFactory() const;
@@ -350,6 +350,19 @@ public:
const QString &preferredHandler = QString(),
const ChannelRequestHints &hints = ChannelRequestHints());
+ PendingChannelRequest *createConferenceCall(
+ const QList<ChannelPtr> &channels,
+ const QStringList &initialInviteeContactsIdentifiers = QStringList(),
+ const QDateTime &userActionTime = QDateTime::currentDateTime(),
+ const QString &preferredHandler = QString(),
+ const ChannelRequestHints &hints = ChannelRequestHints());
+ PendingChannelRequest *createConferenceCall(
+ const QList<ChannelPtr> &channels,
+ const QList<ContactPtr> &initialInviteeContacts = QList<ContactPtr>(),
+ const QDateTime &userActionTime = QDateTime::currentDateTime(),
+ const QString &preferredHandler = QString(),
+ const ChannelRequestHints &hints = ChannelRequestHints());
+
PendingChannelRequest *createConferenceTextChat(
const QList<ChannelPtr> &channels,
const QList<ContactPtr> &initialInviteeContacts = QList<ContactPtr>(),
@@ -378,6 +391,15 @@ public:
const QString &preferredHandler = QString(),
const ChannelRequestHints &hints = ChannelRequestHints());
+ PendingChannel *createAndHandleConferenceCall(
+ const QList<ChannelPtr> &channels,
+ const QStringList &initialInviteeContactsIdentifiers = QStringList(),
+ const QDateTime &userActionTime = QDateTime::currentDateTime());
+ PendingChannel *createAndHandleConferenceCall(
+ const QList<ChannelPtr> &channels,
+ const QList<ContactPtr> &initialInviteeContacts = QList<ContactPtr>(),
+ const QDateTime &userActionTime = QDateTime::currentDateTime());
+
PendingChannelRequest *createContactSearch(
const QString &server,
uint limit = 0,
diff --git a/TelepathyQt/avatar.h b/TelepathyQt/avatar.h
index c48d3fd1..6d3aebd4 100644
--- a/TelepathyQt/avatar.h
+++ b/TelepathyQt/avatar.h
@@ -59,7 +59,7 @@ public:
AvatarSpec(const AvatarSpec &other);
~AvatarSpec();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
AvatarSpec &operator=(const AvatarSpec &other);
@@ -80,7 +80,7 @@ private:
} // Tp
-Q_DECLARE_METATYPE(Tp::AvatarData);
-Q_DECLARE_METATYPE(Tp::AvatarSpec);
+Q_DECLARE_METATYPE(Tp::AvatarData)
+Q_DECLARE_METATYPE(Tp::AvatarSpec)
#endif
diff --git a/TelepathyQt/base-call-internal.h b/TelepathyQt/base-call-internal.h
new file mode 100644
index 00000000..3fff0319
--- /dev/null
+++ b/TelepathyQt/base-call-internal.h
@@ -0,0 +1,136 @@
+/**
+ * This file is part of TelepathyQt
+ *
+ * @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com>
+ * @copyright Copyright 2013 Canonical Ltd.
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "TelepathyQt/_gen/svc-call.h"
+
+#include <TelepathyQt/Global>
+#include <TelepathyQt/MethodInvocationContext>
+#include <TelepathyQt/Constants>
+#include <TelepathyQt/Types>
+#include "TelepathyQt/debug-internal.h"
+
+
+namespace Tp
+{
+
+class TP_QT_NO_EXPORT BaseCallContent::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name)
+ Q_PROPERTY(uint type READ type)
+ Q_PROPERTY(uint disposition READ disposition)
+ Q_PROPERTY(Tp::ObjectPathList streams READ streams)
+ Q_PROPERTY(QStringList interfaces READ interfaces)
+
+public:
+ Adaptee(const QDBusConnection &dbusConnection, BaseCallContent *content);
+ ~Adaptee() override;
+ QStringList interfaces() const;
+
+ QString name() const {
+ return mContent->name();
+ }
+
+ uint type() const {
+ return mContent->type();
+ }
+
+ uint disposition() const {
+ return mContent->disposition();
+ }
+
+ Tp::ObjectPathList streams() const {
+ return mContent->streams();
+ }
+
+public Q_SLOTS:
+ void remove(const Tp::Service::CallContentAdaptor::RemoveContextPtr &context);
+
+
+Q_SIGNALS:
+ void streamsAdded(const Tp::ObjectPathList &streams);
+ void streamsRemoved(const Tp::ObjectPathList &streams, const Tp::CallStateReason &reason);
+
+private:
+ BaseCallContent *mContent;
+ Service::CallContentAdaptor *mAdaptor;
+};
+
+
+class TP_QT_NO_EXPORT BaseCallMuteInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(uint localMuteState READ localMuteState)
+
+public:
+ Adaptee(BaseCallMuteInterface *content);
+ ~Adaptee() override;
+ QStringList interfaces() const;
+
+ uint localMuteState() const {
+ return mInterface->localMuteState();
+ }
+
+public Q_SLOTS:
+ void requestMuted(bool muted, const Tp::Service::CallInterfaceMuteAdaptor::RequestMutedContextPtr &context);
+
+Q_SIGNALS:
+ void muteStateChanged(uint muteState);
+
+public:
+ BaseCallMuteInterface *mInterface;
+ Service::CallInterfaceMuteAdaptor *mAdaptor;
+};
+
+class TP_QT_NO_EXPORT BaseCallContentDTMFInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool currentlySendingTones READ currentlySendingTones)
+ Q_PROPERTY(QString deferredTones READ deferredTones)
+
+public:
+ Adaptee(BaseCallContentDTMFInterface *interface);
+ ~Adaptee() override;
+ QStringList interfaces() const;
+
+ bool currentlySendingTones() const {
+ return mInterface->currentlySendingTones();
+ }
+ QString deferredTones() const {
+ return mInterface->deferredTones();
+ }
+
+public Q_SLOTS:
+ void multipleTones(const QString& tones, const Tp::Service::CallContentInterfaceDTMFAdaptor::MultipleTonesContextPtr &context);
+ void startTone(uchar event, const Tp::Service::CallContentInterfaceDTMFAdaptor::StartToneContextPtr &context);
+ void stopTone(const Tp::Service::CallContentInterfaceDTMFAdaptor::StopToneContextPtr &context);
+Q_SIGNALS:
+ void tonesDeferred(const QString& tones);
+ void sendingTones(const QString& tones);
+ void stoppedTones(bool cancelled);
+
+public:
+ BaseCallContentDTMFInterface *mInterface;
+ Service::CallContentInterfaceDTMFAdaptor *mAdaptor;
+};
+
+}
diff --git a/TelepathyQt/base-call.cpp b/TelepathyQt/base-call.cpp
new file mode 100644
index 00000000..8e0f088c
--- /dev/null
+++ b/TelepathyQt/base-call.cpp
@@ -0,0 +1,474 @@
+/**
+ * This file is part of TelepathyQt
+ *
+ * @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com>
+ * @copyright Copyright 2013 Canonical Ltd.
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <TelepathyQt/BaseCall>
+#include <TelepathyQt/BaseChannel>
+#include "TelepathyQt/base-call-internal.h"
+
+#include "TelepathyQt/_gen/base-call.moc.hpp"
+#include "TelepathyQt/_gen/base-call-internal.moc.hpp"
+
+#include "TelepathyQt/debug-internal.h"
+
+#include <TelepathyQt/BaseConnection>
+#include <TelepathyQt/Constants>
+#include <TelepathyQt/DBusObject>
+#include <TelepathyQt/Utils>
+#include <TelepathyQt/AbstractProtocolInterface>
+#include <QString>
+#include <QVariantMap>
+
+namespace Tp
+{
+
+/**
+ * \class AbstractCallContentInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-call.h <TelepathyQt/BaseCall>
+ *
+ * \brief Base class for all the CallContent object interface implementations.
+ */
+
+AbstractCallContentInterface::AbstractCallContentInterface(const QString &interfaceName)
+ : AbstractDBusServiceInterface(interfaceName)
+{
+}
+
+AbstractCallContentInterface::~AbstractCallContentInterface()
+{
+}
+
+BaseCallContent::Adaptee::Adaptee(const QDBusConnection &dbusConnection,
+ BaseCallContent *content)
+ : QObject(content),
+ mContent(content)
+{
+ debug() << "Creating service::CallContentAdaptor for " << content->dbusObject();
+ mAdaptor = new Service::CallContentAdaptor(dbusConnection, this, content->dbusObject());
+}
+
+QStringList BaseCallContent::Adaptee::interfaces() const
+{
+ QStringList ret;
+ foreach(const AbstractCallContentInterfacePtr & iface, mContent->interfaces()) {
+ ret << iface->interfaceName();
+ }
+ ret << TP_QT_IFACE_PROPERTIES;
+ return ret;
+}
+
+BaseCallContent::Adaptee::~Adaptee()
+{
+}
+
+void BaseCallContent::Adaptee::remove(const Tp::Service::CallContentAdaptor::RemoveContextPtr &context)
+{
+ context->setFinished();
+}
+
+struct TP_QT_NO_EXPORT BaseCallContent::Private {
+ Private(BaseCallContent *parent,
+ const QDBusConnection &dbusConnection,
+ BaseChannel* channel,
+ const QString &name,
+ const Tp::MediaStreamType &type,
+ const Tp::MediaStreamDirection &direction)
+ : parent(parent),
+ channel(channel),
+ name(name),
+ type(type),
+ disposition(Tp::CallContentDispositionNone),
+ direction(direction),
+ adaptee(new BaseCallContent::Adaptee(dbusConnection, parent)) {
+ }
+
+ BaseCallContent *parent;
+ BaseChannel *channel;
+
+ QString name;
+ Tp::MediaStreamType type;
+ Tp::CallContentDisposition disposition;
+ Tp::ObjectPathList streams;
+
+ Tp::MediaStreamDirection direction;
+
+ QHash<QString, AbstractCallContentInterfacePtr> interfaces;
+ BaseCallContent::Adaptee *adaptee;
+};
+
+BaseCallContent::BaseCallContent(const QDBusConnection &dbusConnection,
+ BaseChannel* channel,
+ const QString &name,
+ const Tp::MediaStreamType &type,
+ const Tp::MediaStreamDirection &direction)
+ : DBusService(dbusConnection),
+ mPriv(new Private(this, dbusConnection, channel,
+ name, type, direction))
+{
+}
+
+BaseCallContent::~BaseCallContent()
+{
+ delete mPriv;
+}
+
+QVariantMap BaseCallContent::immutableProperties() const
+{
+ QVariantMap map;
+ map.insert(TP_QT_IFACE_CALL_CONTENT + QLatin1String(".Interfaces"),
+ QVariant::fromValue(mPriv->adaptee->interfaces()));
+ map.insert(TP_QT_IFACE_CALL_CONTENT + QLatin1String(".Name"),
+ QVariant::fromValue(mPriv->adaptee->name()));
+ map.insert(TP_QT_IFACE_CALL_CONTENT + QLatin1String(".Type"),
+ QVariant::fromValue((uint)mPriv->adaptee->type()));
+ map.insert(TP_QT_IFACE_CALL_CONTENT + QLatin1String(".Disposition"),
+ QVariant::fromValue((uint)mPriv->adaptee->disposition()));
+ return map;
+}
+
+QString BaseCallContent::name() const {
+ return mPriv->name;
+}
+
+Tp::MediaStreamType BaseCallContent::type() const {
+ return mPriv->type;
+}
+
+Tp::CallContentDisposition BaseCallContent::disposition() const {
+ return mPriv->disposition;
+}
+
+Tp::ObjectPathList BaseCallContent::streams() const {
+ return mPriv->streams;
+}
+
+QString BaseCallContent::uniqueName() const
+{
+ return QString(QLatin1String("_%1")).arg((quintptr) this, 0, 16);
+}
+
+bool BaseCallContent::registerObject(DBusError *error)
+{
+ if (isRegistered()) {
+ return true;
+ }
+
+ QString name = mPriv->name;
+ QString busName = mPriv->channel->busName();
+ QString objectPath = QString(QLatin1String("%1/%2"))
+ .arg(mPriv->channel->objectPath(), name);
+ debug() << "Registering Content: busName: " << busName << " objectName: " << objectPath;
+ DBusError _error;
+
+ debug() << "CallContent: registering interfaces at " << dbusObject();
+ foreach(const AbstractCallContentInterfacePtr & iface, mPriv->interfaces) {
+ if (!iface->registerInterface(dbusObject())) {
+ // lets not fail if an optional interface fails registering, lets warn only
+ warning() << "Unable to register interface" << iface->interfaceName();
+ }
+ }
+
+ bool ret = registerObject(busName, objectPath, &_error);
+ if (!ret && error) {
+ error->set(_error.name(), _error.message());
+ }
+ return ret;
+}
+
+/**
+ * Reimplemented from DBusService.
+ */
+bool BaseCallContent::registerObject(const QString &busName,
+ const QString &objectPath, DBusError *error)
+{
+ return DBusService::registerObject(busName, objectPath, error);
+}
+
+QList<AbstractCallContentInterfacePtr> BaseCallContent::interfaces() const
+{
+ return mPriv->interfaces.values();
+}
+
+bool BaseCallContent::plugInterface(const AbstractCallContentInterfacePtr &interface)
+{
+ if (isRegistered()) {
+ warning() << "Unable to plug protocol interface " << interface->interfaceName() <<
+ "- protocol already registered";
+ return false;
+ }
+
+ if (interface->isRegistered()) {
+ warning() << "Unable to plug protocol interface" << interface->interfaceName() <<
+ "- interface already registered";
+ return false;
+ }
+
+ if (mPriv->interfaces.contains(interface->interfaceName())) {
+ warning() << "Unable to plug protocol interface" << interface->interfaceName() <<
+ "- another interface with same name already plugged";
+ return false;
+ }
+
+ debug() << "Interface" << interface->interfaceName() << "plugged";
+ mPriv->interfaces.insert(interface->interfaceName(), interface);
+ return true;
+}
+
+// Call.I.Mute
+BaseCallMuteInterface::Adaptee::Adaptee(BaseCallMuteInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseCallMuteInterface::Adaptee::~Adaptee()
+{
+}
+
+struct TP_QT_NO_EXPORT BaseCallMuteInterface::Private {
+ Private(BaseCallMuteInterface *parent, Tp::LocalMuteState state)
+ : state(state),
+ adaptee(new BaseCallMuteInterface::Adaptee(parent)) {
+ }
+
+ SetMuteStateCallback setMuteStateCB;
+ Tp::LocalMuteState state;
+ BaseCallMuteInterface::Adaptee *adaptee;
+};
+
+void BaseCallMuteInterface::Adaptee::requestMuted(bool mute, const Tp::Service::CallInterfaceMuteAdaptor::RequestMutedContextPtr &context)
+{
+ if (!mInterface->mPriv->setMuteStateCB.isValid()) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+
+ Tp::LocalMuteState state = Tp::LocalMuteStateUnmuted;
+ if (mute) {
+ state = Tp::LocalMuteStateMuted;
+ }
+
+ DBusError error;
+ mInterface->mPriv->setMuteStateCB(state, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+
+/**
+ * \class BaseCallMuteInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-call.h <TelepathyQt/BaseCall>
+ *
+ * \brief Base class for implementations of Call.Interface.Mute
+ *
+ */
+
+/**
+ * Class constructor.
+ */
+BaseCallMuteInterface::BaseCallMuteInterface()
+ : AbstractChannelInterface(TP_QT_IFACE_CALL_INTERFACE_MUTE),
+ mPriv(new Private(this, Tp::LocalMuteStateUnmuted))
+{
+}
+
+Tp::LocalMuteState BaseCallMuteInterface::localMuteState() const
+{
+ return mPriv->state;
+}
+
+void BaseCallMuteInterface::setMuteState(const Tp::LocalMuteState &state)
+{
+ if (mPriv->state != state) {
+ mPriv->state = state;
+ QMetaObject::invokeMethod(mPriv->adaptee, "muteStateChanged", Q_ARG(uint, state));
+ }
+}
+
+void BaseCallMuteInterface::setSetMuteStateCallback(const SetMuteStateCallback &cb)
+{
+ mPriv->setMuteStateCB = cb;
+}
+
+/**
+ * Class destructor.
+ */
+BaseCallMuteInterface::~BaseCallMuteInterface()
+{
+ delete mPriv;
+}
+
+void BaseCallMuteInterface::createAdaptor()
+{
+ (void) new Service::CallInterfaceMuteAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+// Call.Content.Interface.DTMF
+BaseCallContentDTMFInterface::Adaptee::Adaptee(BaseCallContentDTMFInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseCallContentDTMFInterface::Adaptee::~Adaptee()
+{
+}
+
+struct TP_QT_NO_EXPORT BaseCallContentDTMFInterface::Private {
+ Private(BaseCallContentDTMFInterface *parent)
+ : currentlySendingTones(false),
+ adaptee(new BaseCallContentDTMFInterface::Adaptee(parent)) {
+ }
+
+ StartToneCallback startToneCB;
+ StopToneCallback stopToneCB;
+ MultipleTonesCallback multipleTonesCB;
+ bool currentlySendingTones;
+ QString deferredTones;
+ BaseCallContentDTMFInterface::Adaptee *adaptee;
+};
+
+void BaseCallContentDTMFInterface::Adaptee::startTone(uchar event, const Tp::Service::CallContentInterfaceDTMFAdaptor::StartToneContextPtr &context)
+{
+ if (!mInterface->mPriv->startToneCB.isValid()) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+
+ DBusError error;
+ mInterface->mPriv->startToneCB(event, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseCallContentDTMFInterface::Adaptee::stopTone(const Tp::Service::CallContentInterfaceDTMFAdaptor::StopToneContextPtr &context)
+{
+ if (!mInterface->mPriv->stopToneCB.isValid()) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+
+ DBusError error;
+ mInterface->mPriv->stopToneCB(&error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+
+void BaseCallContentDTMFInterface::Adaptee::multipleTones(const QString& tones, const Tp::Service::CallContentInterfaceDTMFAdaptor::MultipleTonesContextPtr &context)
+{
+ if (!mInterface->mPriv->multipleTonesCB.isValid()) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+
+ DBusError error;
+ mInterface->mPriv->multipleTonesCB(tones, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+/**
+ * \class BaseCallContentDTMFInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-call.h <TelepathyQt/BaseCall>
+ *
+ * \brief Base class for implementations of Call.Content.Interface.DTMF
+ *
+ */
+
+/**
+ * Class constructor.
+ */
+BaseCallContentDTMFInterface::BaseCallContentDTMFInterface()
+ : AbstractCallContentInterface(TP_QT_IFACE_CALL_CONTENT_INTERFACE_DTMF),
+ mPriv(new Private(this))
+{
+}
+
+bool BaseCallContentDTMFInterface::currentlySendingTones() const
+{
+ return mPriv->currentlySendingTones;
+}
+
+void BaseCallContentDTMFInterface::setCurrentlySendingTones(bool sending)
+{
+ mPriv->currentlySendingTones = sending;
+}
+
+QString BaseCallContentDTMFInterface::deferredTones() const
+{
+ return mPriv->deferredTones;
+}
+
+void BaseCallContentDTMFInterface::setDeferredTones(const QString &tones)
+{
+ mPriv->deferredTones = tones;
+}
+
+
+void BaseCallContentDTMFInterface::setStartToneCallback(const StartToneCallback &cb)
+{
+ mPriv->startToneCB = cb;
+}
+
+void BaseCallContentDTMFInterface::setStopToneCallback(const StopToneCallback &cb)
+{
+ mPriv->stopToneCB = cb;
+}
+
+
+void BaseCallContentDTMFInterface::setMultipleTonesCallback(const MultipleTonesCallback &cb)
+{
+ mPriv->multipleTonesCB = cb;
+}
+
+/**
+ * Class destructor.
+ */
+BaseCallContentDTMFInterface::~BaseCallContentDTMFInterface()
+{
+ delete mPriv;
+}
+
+void BaseCallContentDTMFInterface::createAdaptor()
+{
+ (void) new Service::CallContentInterfaceDTMFAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+}
+
diff --git a/TelepathyQt/base-call.h b/TelepathyQt/base-call.h
new file mode 100644
index 00000000..5eba8b7d
--- /dev/null
+++ b/TelepathyQt/base-call.h
@@ -0,0 +1,186 @@
+/**
+ * This file is part of TelepathyQt
+ *
+ * @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com>
+ * @copyright Copyright 2013 Canonical Ltd.
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _TelepathyQt_base_call_h_HEADER_GUARD_
+#define _TelepathyQt_base_call_h_HEADER_GUARD_
+
+#ifndef IN_TP_QT_HEADER
+#error IN_TP_QT_HEADER
+#endif
+
+
+#include <TelepathyQt/DBusService>
+#include <TelepathyQt/Global>
+#include <TelepathyQt/Types>
+#include <TelepathyQt/Callbacks>
+#include <TelepathyQt/Constants>
+#include <TelepathyQt/BaseChannel>
+
+#include <QDBusConnection>
+
+class QString;
+
+namespace Tp
+{
+
+class TP_QT_EXPORT AbstractCallContentInterface : public AbstractDBusServiceInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(AbstractCallContentInterface)
+
+public:
+ AbstractCallContentInterface(const QString &interfaceName);
+ ~AbstractCallContentInterface() override;
+
+private:
+ friend class BaseCallContent;
+
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseCallContent : public DBusService
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseCallContent)
+
+public:
+ static BaseCallContentPtr create(const QDBusConnection &dbusConnection,
+ BaseChannel* channel,
+ const QString &name,
+ const Tp::MediaStreamType &type,
+ const Tp::MediaStreamDirection &direction) {
+ return BaseCallContentPtr(new BaseCallContent(dbusConnection, channel, name, type, direction));
+ }
+
+ ~BaseCallContent() override;
+ QVariantMap immutableProperties() const override;
+ bool registerObject(DBusError *error = nullptr);
+ virtual QString uniqueName() const;
+
+ QList<AbstractCallContentInterfacePtr> interfaces() const;
+ AbstractCallContentInterfacePtr interface(const QString &interfaceName) const;
+ bool plugInterface(const AbstractCallContentInterfacePtr &interface);
+
+ QString name() const;
+ Tp::MediaStreamType type() const;
+ Tp::CallContentDisposition disposition() const;
+ Tp::ObjectPathList streams() const;
+protected:
+ BaseCallContent(const QDBusConnection &dbusConnection,
+ BaseChannel* channel,
+ const QString &name,
+ const Tp::MediaStreamType &type,
+ const Tp::MediaStreamDirection &direction);
+
+ bool registerObject(const QString &busName, const QString &objectPath,
+ DBusError *error) override;
+ void remove();
+
+private:
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseCallMuteInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseCallMuteInterface)
+
+public:
+ static BaseCallMuteInterfacePtr create() {
+ return BaseCallMuteInterfacePtr(new BaseCallMuteInterface());
+ }
+ template<typename BaseCallMuteInterfaceSubclass>
+ static SharedPtr<BaseCallMuteInterfaceSubclass> create() {
+ return SharedPtr<BaseCallMuteInterfaceSubclass>(
+ new BaseCallMuteInterfaceSubclass());
+ }
+ ~BaseCallMuteInterface() override;
+
+ Tp::LocalMuteState localMuteState() const;
+ void setMuteState(const Tp::LocalMuteState &state);
+
+ typedef Callback2<void, const Tp::LocalMuteState&, DBusError*> SetMuteStateCallback;
+ void setSetMuteStateCallback(const SetMuteStateCallback &cb);
+Q_SIGNALS:
+ void muteStateChanged(const Tp::LocalMuteState &state);
+private:
+ BaseCallMuteInterface();
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseCallContentDTMFInterface : public AbstractCallContentInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseCallContentDTMFInterface)
+
+public:
+ static BaseCallContentDTMFInterfacePtr create() {
+ return BaseCallContentDTMFInterfacePtr(new BaseCallContentDTMFInterface());
+ }
+ template<typename BaseCallContentDTMFInterfaceSubclass>
+ static SharedPtr<BaseCallContentDTMFInterfaceSubclass> create() {
+ return SharedPtr<BaseCallContentDTMFInterfaceSubclass>(
+ new BaseCallContentDTMFInterfaceSubclass());
+ }
+ ~BaseCallContentDTMFInterface() override;
+
+ bool currentlySendingTones() const;
+ void setCurrentlySendingTones(bool sendingTones);
+
+ QString deferredTones() const;
+ void setDeferredTones(const QString &deferredTones);
+
+
+ typedef Callback2<void, uchar, DBusError*> StartToneCallback;
+ void setStartToneCallback(const StartToneCallback &cb);
+ typedef Callback1<void, DBusError*> StopToneCallback;
+ void setStopToneCallback(const StopToneCallback &cb);
+ typedef Callback2<void, const QString&, DBusError*> MultipleTonesCallback;
+ void setMultipleTonesCallback(const MultipleTonesCallback &cb);
+Q_SIGNALS:
+
+private:
+ BaseCallContentDTMFInterface();
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+
+}
+#endif
diff --git a/TelepathyQt/base-channel-internal.h b/TelepathyQt/base-channel-internal.h
index e0238d03..bdae07d6 100644
--- a/TelepathyQt/base-channel-internal.h
+++ b/TelepathyQt/base-channel-internal.h
@@ -2,6 +2,7 @@
* This file is part of TelepathyQt
*
* @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com>
+ * @copyright Copyright 2013 Canonical Ltd.
* @license LGPL 2.1
*
* This library is free software; you can redistribute it and/or
@@ -44,7 +45,7 @@ class TP_QT_NO_EXPORT BaseChannel::Adaptee : public QObject
Q_PROPERTY(QString initiatorID READ initiatorID)
public:
Adaptee(const QDBusConnection &dbusConnection, BaseChannel *cm);
- ~Adaptee();
+ ~Adaptee() override;
QString channelType() const {
return mChannel->channelType();
@@ -97,7 +98,7 @@ class TP_QT_NO_EXPORT BaseChannelTextType::Adaptee : public QObject
Q_OBJECT
public:
Adaptee(BaseChannelTextType *interface);
- ~Adaptee();
+ ~Adaptee() override;
public slots:
void acknowledgePendingMessages(const Tp::UIntList &IDs, const Tp::Service::ChannelTypeTextAdaptor::AcknowledgePendingMessagesContextPtr &context);
@@ -125,7 +126,7 @@ class TP_QT_NO_EXPORT BaseChannelMessagesInterface::Adaptee : public QObject
Q_PROPERTY(uint deliveryReportingSupport READ deliveryReportingSupport)
public:
Adaptee(BaseChannelMessagesInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
QStringList supportedContentTypes() {
return mInterface->supportedContentTypes();
@@ -156,13 +157,94 @@ public:
BaseChannelMessagesInterface *mInterface;
};
+class TP_QT_NO_EXPORT BaseChannelFileTransferType::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(uint state READ state)
+ Q_PROPERTY(QString contentType READ contentType)
+ Q_PROPERTY(QString filename READ filename)
+ Q_PROPERTY(qulonglong size READ size)
+ Q_PROPERTY(uint contentHashType READ contentHashType)
+ Q_PROPERTY(QString contentHash READ contentHash)
+ Q_PROPERTY(QString description READ description)
+ Q_PROPERTY(qlonglong date READ date)
+ Q_PROPERTY(Tp::SupportedSocketMap availableSocketTypes READ availableSocketTypes)
+ Q_PROPERTY(qulonglong transferredBytes READ transferredBytes)
+ Q_PROPERTY(qulonglong initialOffset READ initialOffset)
+ Q_PROPERTY(QString uri READ uri WRITE setUri)
+ Q_PROPERTY(QString fileCollection READ fileCollection)
+
+public:
+ Adaptee(BaseChannelFileTransferType *interface);
+ ~Adaptee() override;
+
+ uint state() const;
+ QString contentType() const;
+ QString filename() const;
+ qulonglong size() const;
+ uint contentHashType() const;
+ QString contentHash() const;
+ QString description() const;
+ qlonglong date() const;
+ Tp::SupportedSocketMap availableSocketTypes() const;
+ qulonglong transferredBytes() const;
+ qulonglong initialOffset() const;
+ QString uri() const;
+ QString fileCollection() const;
+
+public Q_SLOTS:
+ void setUri(const QString &uri);
+
+private Q_SLOTS:
+ void acceptFile(uint addressType, uint accessControl, const QDBusVariant &accessControlParam, qulonglong offset,
+ const Tp::Service::ChannelTypeFileTransferAdaptor::AcceptFileContextPtr &context);
+ void provideFile(uint addressType, uint accessControl, const QDBusVariant &accessControlParam,
+ const Tp::Service::ChannelTypeFileTransferAdaptor::ProvideFileContextPtr &context);
+
+Q_SIGNALS:
+ void fileTransferStateChanged(uint state, uint reason);
+ void transferredBytesChanged(qulonglong count);
+ void initialOffsetDefined(qulonglong initialOffset);
+ void uriDefined(const QString &uri);
+
+private:
+ BaseChannelFileTransferType *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseChannelRoomListType::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString server READ server)
+
+public:
+ Adaptee(BaseChannelRoomListType *interface);
+ ~Adaptee() override;
+
+ QString server() const;
+
+private Q_SLOTS:
+ void getListingRooms(
+ const Tp::Service::ChannelTypeRoomListAdaptor::GetListingRoomsContextPtr &context);
+ void listRooms(
+ const Tp::Service::ChannelTypeRoomListAdaptor::ListRoomsContextPtr &context);
+ void stopListing(
+ const Tp::Service::ChannelTypeRoomListAdaptor::StopListingContextPtr &context);
+
+Q_SIGNALS:
+ void gotRooms(const Tp::RoomInfoList &rooms);
+ void listingRooms(bool listing);
+
+private:
+ BaseChannelRoomListType *mInterface;
+};
+
class TP_QT_NO_EXPORT BaseChannelServerAuthenticationType::Adaptee : public QObject
{
Q_OBJECT
Q_PROPERTY(QString authenticationMethod READ authenticationMethod)
public:
Adaptee(BaseChannelServerAuthenticationType *interface);
- ~Adaptee();
+ ~Adaptee() override;
QString authenticationMethod() const;
public:
BaseChannelServerAuthenticationType *mInterface;
@@ -177,7 +259,7 @@ class TP_QT_NO_EXPORT BaseChannelCaptchaAuthenticationInterface::Adaptee : publi
Q_PROPERTY(QVariantMap captchaErrorDetails READ captchaErrorDetails)
public:
Adaptee(BaseChannelCaptchaAuthenticationInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
bool canRetryCaptcha() const;
uint captchaStatus() const;
QString captchaError() const;
@@ -191,6 +273,94 @@ public:
BaseChannelCaptchaAuthenticationInterface *mInterface;
};
+class TP_QT_NO_EXPORT BaseChannelSASLAuthenticationInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList availableMechanisms READ availableMechanisms)
+ Q_PROPERTY(bool hasInitialData READ hasInitialData)
+ Q_PROPERTY(bool canTryAgain READ canTryAgain)
+ Q_PROPERTY(uint saslStatus READ saslStatus)
+ Q_PROPERTY(QString saslError READ saslError)
+ Q_PROPERTY(QVariantMap saslErrorDetails READ saslErrorDetails)
+ Q_PROPERTY(QString authorizationIdentity READ authorizationIdentity)
+ Q_PROPERTY(QString defaultUsername READ defaultUsername)
+ Q_PROPERTY(QString defaultRealm READ defaultRealm)
+ Q_PROPERTY(bool maySaveResponse READ maySaveResponse)
+
+public:
+ Adaptee(BaseChannelSASLAuthenticationInterface *interface);
+ ~Adaptee() override;
+
+ QStringList availableMechanisms() const;
+ bool hasInitialData() const;
+ bool canTryAgain() const;
+ uint saslStatus() const;
+ QString saslError() const;
+ QVariantMap saslErrorDetails() const;
+ QString authorizationIdentity() const;
+ QString defaultUsername() const;
+ QString defaultRealm() const;
+ bool maySaveResponse() const;
+
+private Q_SLOTS:
+ void startMechanism(const QString &mechanism,
+ const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::StartMechanismContextPtr &context);
+ void startMechanismWithData(const QString &mechanism, const QByteArray &initialData,
+ const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::StartMechanismWithDataContextPtr &context);
+ void respond(const QByteArray &responseData,
+ const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::RespondContextPtr &context);
+ void acceptSasl(
+ const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::AcceptSASLContextPtr &context);
+ void abortSasl(uint reason, const QString &debugMessage,
+ const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::AbortSASLContextPtr &context);
+
+signals:
+ void saslStatusChanged(uint status, const QString &reason, const QVariantMap &details);
+ void newChallenge(const QByteArray &challengeData);
+
+private:
+ BaseChannelSASLAuthenticationInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseChannelSecurableInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool encrypted READ encrypted)
+ Q_PROPERTY(bool verified READ verified)
+
+public:
+ Adaptee(BaseChannelSecurableInterface *interface);
+ ~Adaptee() override;
+
+ bool encrypted() const;
+ bool verified() const;
+
+private:
+ BaseChannelSecurableInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseChannelChatStateInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(Tp::ChatStateMap chatStates READ chatStates)
+
+public:
+ Adaptee(BaseChannelChatStateInterface *interface);
+ ~Adaptee() override;
+
+ Tp::ChatStateMap chatStates() const;
+
+private Q_SLOTS:
+ void setChatState(uint state,
+ const Tp::Service::ChannelInterfaceChatStateAdaptor::SetChatStateContextPtr &context);
+
+signals:
+ void chatStateChanged(uint contact, uint state);
+
+private:
+ BaseChannelChatStateInterface *mInterface;
+};
+
class TP_QT_NO_EXPORT BaseChannelGroupInterface::Adaptee : public QObject
{
Q_OBJECT
@@ -201,9 +371,11 @@ class TP_QT_NO_EXPORT BaseChannelGroupInterface::Adaptee : public QObject
Q_PROPERTY(Tp::UIntList remotePendingMembers READ remotePendingMembers)
Q_PROPERTY(uint selfHandle READ selfHandle)
Q_PROPERTY(Tp::HandleIdentifierMap memberIdentifiers READ memberIdentifiers)
+
public:
Adaptee(BaseChannelGroupInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
+
uint groupFlags() const;
Tp::HandleOwnerMap handleOwners() const;
Tp::LocalPendingInfoList localPendingMembers() const;
@@ -211,27 +383,298 @@ public:
Tp::UIntList remotePendingMembers() const;
uint selfHandle() const;
Tp::HandleIdentifierMap memberIdentifiers() const;
-public slots:
- void addMembers(const Tp::UIntList &contacts, const QString &message, const Tp::Service::ChannelInterfaceGroupAdaptor::AddMembersContextPtr &context);
- void getAllMembers(const Tp::Service::ChannelInterfaceGroupAdaptor::GetAllMembersContextPtr &context);
- void getGroupFlags(const Tp::Service::ChannelInterfaceGroupAdaptor::GetGroupFlagsContextPtr &context);
- void getHandleOwners(const Tp::UIntList &handles, const Tp::Service::ChannelInterfaceGroupAdaptor::GetHandleOwnersContextPtr &context);
- void getLocalPendingMembers(const Tp::Service::ChannelInterfaceGroupAdaptor::GetLocalPendingMembersContextPtr &context);
- void getLocalPendingMembersWithInfo(const Tp::Service::ChannelInterfaceGroupAdaptor::GetLocalPendingMembersWithInfoContextPtr &context);
- void getMembers(const Tp::Service::ChannelInterfaceGroupAdaptor::GetMembersContextPtr &context);
- void getRemotePendingMembers(const Tp::Service::ChannelInterfaceGroupAdaptor::GetRemotePendingMembersContextPtr &context);
- void getSelfHandle(const Tp::Service::ChannelInterfaceGroupAdaptor::GetSelfHandleContextPtr &context);
- void removeMembers(const Tp::UIntList &contacts, const QString &message, const Tp::Service::ChannelInterfaceGroupAdaptor::RemoveMembersContextPtr &context);
- void removeMembersWithReason(const Tp::UIntList &contacts, const QString &message, uint reason, const Tp::Service::ChannelInterfaceGroupAdaptor::RemoveMembersWithReasonContextPtr &context);
-signals:
+
+private Q_SLOTS:
+ void addMembers(const Tp::UIntList &contacts, const QString &message,
+ const Tp::Service::ChannelInterfaceGroupAdaptor::AddMembersContextPtr &context);
+ void removeMembers(const Tp::UIntList &contacts, const QString &message,
+ const Tp::Service::ChannelInterfaceGroupAdaptor::RemoveMembersContextPtr &context);
+ void removeMembersWithReason(const Tp::UIntList &contacts, const QString &message, uint reason,
+ const Tp::Service::ChannelInterfaceGroupAdaptor::RemoveMembersWithReasonContextPtr &context);
+
+Q_SIGNALS:
+ void handleOwnersChanged(const Tp::HandleOwnerMap &added, const Tp::UIntList &removed);
void handleOwnersChangedDetailed(const Tp::HandleOwnerMap &added, const Tp::UIntList &removed, const Tp::HandleIdentifierMap &identifiers);
+ void selfHandleChanged(uint selfHandle);
void selfContactChanged(uint selfHandle, const QString &selfID);
void groupFlagsChanged(uint added, uint removed);
void membersChanged(const QString &message, const Tp::UIntList &added, const Tp::UIntList &removed, const Tp::UIntList &localPending, const Tp::UIntList &remotePending, uint actor, uint reason);
void membersChangedDetailed(const Tp::UIntList &added, const Tp::UIntList &removed, const Tp::UIntList &localPending, const Tp::UIntList &remotePending, const QVariantMap &details);
- //All other signals are deprecated
-public:
+
+private:
BaseChannelGroupInterface *mInterface;
};
+class TP_QT_NO_EXPORT BaseChannelRoomInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString roomName READ roomName)
+ Q_PROPERTY(QString server READ server)
+ Q_PROPERTY(QString creator READ creator)
+ Q_PROPERTY(uint creatorHandle READ creatorHandle)
+ Q_PROPERTY(qlonglong creationTimestamp READ creationTimestamp)
+
+public:
+ Adaptee(BaseChannelRoomInterface *interface);
+ ~Adaptee() override;
+
+ QString roomName() const;
+ QString server() const;
+ QString creator() const;
+ uint creatorHandle() const;
+ qlonglong creationTimestamp() const;
+
+private:
+ BaseChannelRoomInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseChannelRoomConfigInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool anonymous READ anonymous)
+ Q_PROPERTY(bool inviteOnly READ inviteOnly)
+ Q_PROPERTY(uint limit READ limit)
+ Q_PROPERTY(bool moderated READ moderated)
+ Q_PROPERTY(QString title READ title)
+ Q_PROPERTY(QString description READ description)
+ Q_PROPERTY(bool persistent READ persistent)
+ Q_PROPERTY(bool private READ isPrivate)
+ Q_PROPERTY(bool passwordProtected READ passwordProtected)
+ Q_PROPERTY(QString password READ password)
+ Q_PROPERTY(QString passwordHint READ passwordHint)
+ Q_PROPERTY(bool canUpdateConfiguration READ canUpdateConfiguration)
+ Q_PROPERTY(QStringList mutableProperties READ mutableProperties)
+ Q_PROPERTY(bool configurationRetrieved READ configurationRetrieved)
+
+public:
+ Adaptee(BaseChannelRoomConfigInterface *interface);
+ ~Adaptee() override;
+
+ bool anonymous() const;
+ bool inviteOnly() const;
+ uint limit() const;
+ bool moderated() const;
+ QString title() const;
+ QString description() const;
+ bool persistent() const;
+ bool isPrivate() const;
+ bool passwordProtected() const;
+ QString password() const;
+ QString passwordHint() const;
+ bool canUpdateConfiguration() const;
+ QStringList mutableProperties() const;
+ bool configurationRetrieved() const;
+
+private Q_SLOTS:
+ void updateConfiguration(const QVariantMap &properties,
+ const Tp::Service::ChannelInterfaceRoomConfigAdaptor::UpdateConfigurationContextPtr &context);
+
+private:
+ BaseChannelRoomConfigInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseChannelCallType::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(Tp::ObjectPathList contents READ contents)
+ Q_PROPERTY(QVariantMap callStateDetails READ callStateDetails)
+ Q_PROPERTY(uint callState READ callState)
+ Q_PROPERTY(uint callFlags READ callFlags)
+ Q_PROPERTY(Tp::CallStateReason callStateReason READ callStateReason)
+ Q_PROPERTY(bool hardwareStreaming READ hardwareStreaming)
+ Q_PROPERTY(Tp::CallMemberMap callMembers READ callMembers)
+ Q_PROPERTY(Tp::HandleIdentifierMap memberIdentifiers READ memberIdentifiers)
+ Q_PROPERTY(uint initialTransport READ initialTransport)
+ Q_PROPERTY(bool initialAudio READ initialAudio)
+ Q_PROPERTY(bool initialVideo READ initialVideo)
+ Q_PROPERTY(QString initialVideoName READ initialVideoName)
+ Q_PROPERTY(QString initialAudioName READ initialAudioName)
+ Q_PROPERTY(bool mutableContents READ mutableContents)
+
+public:
+ Adaptee(BaseChannelCallType *interface);
+ ~Adaptee() override;
+
+ Tp::ObjectPathList contents() const {
+ return mInterface->contents();
+ }
+
+ QVariantMap callStateDetails() const {
+ return mInterface->callStateDetails();
+ }
+
+ uint callState() const {
+ return mInterface->callState();
+ }
+
+ uint callFlags() const {
+ return mInterface->callFlags();
+ }
+
+ Tp::CallStateReason callStateReason() const {
+ return mInterface->callStateReason();
+ }
+
+ bool hardwareStreaming() const {
+ return mInterface->hardwareStreaming();
+ }
+
+ Tp::CallMemberMap callMembers() const {
+ return mInterface->callMembers();
+ }
+
+ Tp::HandleIdentifierMap memberIdentifiers() const {
+ return mInterface->memberIdentifiers();
+ }
+
+ uint initialTransport() const {
+ return mInterface->initialTransport();
+ }
+
+ bool initialAudio() const {
+ return mInterface->initialAudio();
+ }
+
+ bool initialVideo() const {
+ return mInterface->initialVideo();
+ }
+
+ QString initialVideoName() const {
+ return mInterface->initialVideoName();
+ }
+
+ QString initialAudioName() const {
+ return mInterface->initialAudioName();
+ }
+
+ bool mutableContents() const {
+ return mInterface->mutableContents();
+ }
+
+public slots:
+ void setRinging(const Tp::Service::ChannelTypeCallAdaptor::SetRingingContextPtr &context);
+ void setQueued(const Tp::Service::ChannelTypeCallAdaptor::SetQueuedContextPtr &context);
+ void accept(const Tp::Service::ChannelTypeCallAdaptor::AcceptContextPtr &context);
+ void hangup(uint reason, const QString &detailedHangupReason, const QString &message, const Tp::Service::ChannelTypeCallAdaptor::HangupContextPtr &context);
+ void addContent(const QString &contentName, const Tp::MediaStreamType &contentType, const Tp::MediaStreamDirection &initialDirection, const Tp::Service::ChannelTypeCallAdaptor::AddContentContextPtr &context);
+
+signals:
+ void contentAdded(const QDBusObjectPath &content);
+ void contentRemoved(const QDBusObjectPath &content, const Tp::CallStateReason &reason);
+ void callStateChanged(uint callState, uint callFlags, const Tp::CallStateReason &stateReason, const QVariantMap &callStateDetails);
+ void callMembersChanged(const Tp::CallMemberMap &flagsChanged, const Tp::HandleIdentifierMap &identifiers, const Tp::UIntList &removed, const Tp::CallStateReason &reason);
+
+public:
+ BaseChannelCallType *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseChannelSMSInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool flash READ flash)
+ Q_PROPERTY(bool smsChannel READ smsChannel)
+public:
+ Adaptee(BaseChannelSMSInterface *interface);
+ ~Adaptee() override;
+
+ bool flash() {
+ return mInterface->flash();
+ }
+
+ bool smsChannel() {
+ return mInterface->smsChannel();
+ }
+
+public slots:
+ void getSMSLength(const Tp::MessagePartList &messages, const Tp::Service::ChannelInterfaceSMSAdaptor::GetSMSLengthContextPtr &context);
+signals:
+ void smsChannelChanged(bool smsChannel);
+public:
+ BaseChannelSMSInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseChannelHoldInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+public:
+ Adaptee(BaseChannelHoldInterface *interface);
+ ~Adaptee() override;
+
+public slots:
+ void getHoldState(const Tp::Service::ChannelInterfaceHoldAdaptor::GetHoldStateContextPtr &context);
+ void requestHold(bool hold, const Tp::Service::ChannelInterfaceHoldAdaptor::RequestHoldContextPtr &context);
+signals:
+ void holdStateChanged(uint holdState, uint reason);
+
+public:
+ BaseChannelHoldInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseChannelConferenceInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(Tp::ObjectPathList channels READ channels)
+ Q_PROPERTY(Tp::ObjectPathList initialChannels READ initialChannels)
+ Q_PROPERTY(Tp::UIntList initialInviteeHandles READ initialInviteeHandles)
+ Q_PROPERTY(QStringList initialInviteeIDs READ initialInviteeIDs)
+ Q_PROPERTY(QString invitationMessage READ invitationMessage)
+ Q_PROPERTY(ChannelOriginatorMap originalChannels READ originalChannels)
+public:
+ Adaptee(BaseChannelConferenceInterface *interface);
+ ~Adaptee() override;
+ Tp::ObjectPathList channels() const {
+ return mInterface->channels();
+ }
+ Tp::ObjectPathList initialChannels() const {
+ return mInterface->initialChannels();
+ }
+ Tp::UIntList initialInviteeHandles() const {
+ return mInterface->initialInviteeHandles();
+ }
+ QStringList initialInviteeIDs() const {
+ return mInterface->initialInviteeIDs();
+ }
+ QString invitationMessage() const {
+ return mInterface->invitationMessage();
+ }
+ ChannelOriginatorMap originalChannels() const {
+ return mInterface->originalChannels();
+ }
+
+signals:
+ void channelMerged(const QDBusObjectPath &channel, uint channelHandle, const QVariantMap &properties);
+ void channelRemoved(const QDBusObjectPath &channel, const QVariantMap& details);
+
+public:
+ BaseChannelConferenceInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseChannelMergeableConferenceInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+public:
+ Adaptee(BaseChannelMergeableConferenceInterface *interface);
+ ~Adaptee() override;
+
+public slots:
+ void merge(const QDBusObjectPath &channel, const Tp::Service::ChannelInterfaceMergeableConferenceAdaptor::MergeContextPtr &context);
+
+public:
+ BaseChannelMergeableConferenceInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseChannelSplittableInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+public:
+ Adaptee(BaseChannelSplittableInterface *interface);
+ ~Adaptee() override;
+
+public slots:
+ void split(const Tp::Service::ChannelInterfaceSplittableAdaptor::SplitContextPtr &context);
+
+public:
+ BaseChannelSplittableInterface *mInterface;
+};
+
}
diff --git a/TelepathyQt/base-channel.cpp b/TelepathyQt/base-channel.cpp
index d9d60106..444c7c09 100644
--- a/TelepathyQt/base-channel.cpp
+++ b/TelepathyQt/base-channel.cpp
@@ -2,6 +2,9 @@
* This file is part of TelepathyQt
*
* @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com>
+ * @copyright Copyright (C) 2013 Canonical Ltd.
+ * @copyright Copyright (C) 2016 Alexandr Akulich <akulichalexander@gmail.com>
+ * @copyright Copyright (C) 2016 Niels Ole Salscheider <niels_ole@salscheider-online.de>
* @license LGPL 2.1
*
* This library is free software; you can redistribute it and/or
@@ -20,10 +23,13 @@
*/
#include <TelepathyQt/BaseChannel>
+#include <TelepathyQt/BaseCall>
#include "TelepathyQt/base-channel-internal.h"
#include "TelepathyQt/_gen/base-channel.moc.hpp"
#include "TelepathyQt/_gen/base-channel-internal.moc.hpp"
+#include "TelepathyQt/_gen/future-constants.h"
+#include "TelepathyQt/_gen/future-types.h"
#include "TelepathyQt/debug-internal.h"
@@ -32,30 +38,50 @@
#include <TelepathyQt/DBusObject>
#include <TelepathyQt/Utils>
#include <TelepathyQt/AbstractProtocolInterface>
+
+#include <QDateTime>
#include <QString>
+#include <QTcpServer>
+#include <QTcpSocket>
#include <QVariantMap>
namespace Tp
{
struct TP_QT_NO_EXPORT BaseChannel::Private {
- Private(BaseChannel *parent, const QDBusConnection &dbusConnection, BaseConnection* connection,
- const QString &channelType, uint targetHandle, uint targetHandleType)
+ Private(BaseChannel *parent, const QDBusConnection &dbusConnection, BaseConnection *connection,
+ const QString &channelType, uint targetHandleType, uint targetHandle)
: parent(parent),
connection(connection),
channelType(channelType),
- targetHandle(targetHandle),
targetHandleType(targetHandleType),
+ targetHandle(targetHandle),
+ requested(true),
+ initiatorHandle(0),
adaptee(new BaseChannel::Adaptee(dbusConnection, parent)) {
+ static uint s_channelIncrementalId = 0;
+
+ QString baseName;
+ static const QString s_channelTypePrefix = TP_QT_IFACE_CHANNEL + QLatin1String(".Type.");
+
+ if ((channelType == TP_QT_IFACE_CHANNEL_TYPE_TEXT) && (targetHandleType == Tp::HandleTypeRoom)) {
+ baseName = QLatin1String("Muc");
+ } else if (channelType.startsWith(s_channelTypePrefix)) {
+ baseName = channelType.mid(s_channelTypePrefix.length());
+ }
+
+ uniqueName = baseName + QLatin1String("Channel") + QString::number(s_channelIncrementalId);
+ ++s_channelIncrementalId;
}
BaseChannel *parent;
BaseConnection* connection;
QString channelType;
QHash<QString, AbstractChannelInterfacePtr> interfaces;
+ QString uniqueName;
+ uint targetHandleType;
uint targetHandle;
QString targetID;
- uint targetHandleType;
bool requested;
uint initiatorHandle;
QString initiatorID;
@@ -89,19 +115,13 @@ QStringList BaseChannel::Adaptee::interfaces() const
void BaseChannel::Adaptee::close(const Tp::Service::ChannelAdaptor::CloseContextPtr &context)
{
- //emit after return
- QMetaObject::invokeMethod(this, "closed",
- Qt::QueuedConnection);
- //emit after return
- QMetaObject::invokeMethod(mChannel, "closed",
- Qt::QueuedConnection);
-
+ mChannel->close();
context->setFinished();
}
/**
* \class BaseChannel
- * \ingroup servicecm
+ * \ingroup servicechannel
* \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
*
* \brief Base class for channel implementations.
@@ -109,12 +129,12 @@ void BaseChannel::Adaptee::close(const Tp::Service::ChannelAdaptor::CloseContext
*/
BaseChannel::BaseChannel(const QDBusConnection &dbusConnection,
- BaseConnection* connection,
- const QString &channelType, uint targetHandle,
- uint targetHandleType)
+ BaseConnection *connection,
+ const QString &channelType, uint targetHandleType,
+ uint targetHandle)
: DBusService(dbusConnection),
mPriv(new Private(this, dbusConnection, connection,
- channelType, targetHandle, targetHandleType))
+ channelType, targetHandleType, targetHandle))
{
}
@@ -133,7 +153,12 @@ BaseChannel::~BaseChannel()
*/
QString BaseChannel::uniqueName() const
{
- return QString(QLatin1String("_%1")).arg((quintptr) this, 0, 16);
+ return mPriv->uniqueName;
+}
+
+BaseConnection *BaseChannel::connection() const
+{
+ return mPriv->connection;
}
bool BaseChannel::registerObject(DBusError *error)
@@ -228,6 +253,17 @@ void BaseChannel::setRequested(bool requested)
mPriv->requested = requested;
}
+void BaseChannel::close()
+{
+ foreach(const AbstractChannelInterfacePtr &iface, interfaces()) {
+ iface->close();
+ }
+
+ // Method is used in destructor, so (to be sure that adaptee is exists) we should use DirectConnection
+ QMetaObject::invokeMethod(mPriv->adaptee, "closed", Qt::DirectConnection);
+ emit closed();
+}
+
/**
* Return the immutable properties of this channel object.
*
@@ -319,12 +355,13 @@ bool BaseChannel::plugInterface(const AbstractChannelInterfacePtr &interface)
debug() << "Interface" << interface->interfaceName() << "plugged";
mPriv->interfaces.insert(interface->interfaceName(), interface);
+ interface->setBaseChannel(this);
return true;
}
/**
* \class AbstractChannelInterface
- * \ingroup servicecm
+ * \ingroup servicechannel
* \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
*
* \brief Base class for all the Channel object interface implementations.
@@ -339,6 +376,15 @@ AbstractChannelInterface::~AbstractChannelInterface()
{
}
+void AbstractChannelInterface::close()
+{
+}
+
+void AbstractChannelInterface::setBaseChannel(BaseChannel *channel)
+{
+ Q_UNUSED(channel)
+}
+
// Chan.T.Text
BaseChannelTextType::Adaptee::Adaptee(BaseChannelTextType *interface)
: QObject(interface),
@@ -353,7 +399,7 @@ BaseChannelTextType::Adaptee::~Adaptee()
void BaseChannelTextType::Adaptee::acknowledgePendingMessages(const Tp::UIntList &IDs,
const Tp::Service::ChannelTypeTextAdaptor::AcknowledgePendingMessagesContextPtr &context)
{
- qDebug() << "BaseConnectionContactsInterface::acknowledgePendingMessages " << IDs;
+ debug() << "BaseChannelTextType::acknowledgePendingMessages " << IDs;
DBusError error;
mInterface->acknowledgePendingMessages(IDs, &error);
if (error.isValid()) {
@@ -381,7 +427,7 @@ struct TP_QT_NO_EXPORT BaseChannelTextType::Private {
/**
* \class BaseChannelTextType
- * \ingroup servicecm
+ * \ingroup servicechannel
* \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
*
* \brief Base class for implementations of Channel.Type.Text
@@ -405,19 +451,6 @@ BaseChannelTextType::~BaseChannelTextType()
delete mPriv;
}
-/**
- * Return the immutable properties of this interface.
- *
- * Immutable properties cannot change after the interface has been registered
- * on a service on the bus with registerInterface().
- *
- * \return The immutable properties of this interface.
- */
-QVariantMap BaseChannelTextType::immutableProperties() const
-{
- return QVariantMap();
-}
-
void BaseChannelTextType::createAdaptor()
{
(void) new Service::ChannelTypeTextAdaptor(dbusObject()->dbusConnection(),
@@ -483,7 +516,7 @@ void BaseChannelTextType::addReceivedMessage(const Tp::MessagePartList &msg)
Q_ARG(Tp::MessagePartList, message));
}
-Tp::MessagePartListList BaseChannelTextType::pendingMessages()
+Tp::MessagePartListList BaseChannelTextType::pendingMessages() const
{
return mPriv->pendingMessages.values();
}
@@ -497,20 +530,50 @@ void BaseChannelTextType::setMessageAcknowledgedCallback(const MessageAcknowledg
mPriv->messageAcknowledgedCB = cb;
}
+void BaseChannelTextType::acknowledgePendingMessages(const QStringList &tokens, DBusError *error)
+{
+ Tp::UIntList IDs;
+
+ Q_FOREACH (const QString &token, tokens) {
+ Q_FOREACH (const Tp::MessagePartList &message, mPriv->pendingMessages) {
+ const MessagePart &header = message.front();
+ if (header.value(QLatin1String("message-token")).variant().toString() == token) {
+ uint id = mPriv->pendingMessages.key(message);
+ IDs.append(id);
+ }
+ }
+ }
+
+ if (tokens.count() != IDs.count()) {
+ error->set(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("Token not found"));
+ return;
+ }
+
+ removePendingMessages(IDs);
+}
+
void BaseChannelTextType::acknowledgePendingMessages(const Tp::UIntList &IDs, DBusError* error)
{
- foreach(uint id, IDs) {
+ Q_FOREACH (uint id, IDs) {
QMap<uint, Tp::MessagePartList>::Iterator i = mPriv->pendingMessages.find(id);
if (i == mPriv->pendingMessages.end()) {
error->set(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("id not found"));
return;
}
- MessagePart &header = i->front();
- if (header.count(QLatin1String("message-token")) && mPriv->messageAcknowledgedCB.isValid())
+ const MessagePart &header = i->front();
+ if (header.count(QLatin1String("message-token")) && mPriv->messageAcknowledgedCB.isValid()) {
mPriv->messageAcknowledgedCB(header[QLatin1String("message-token")].variant().toString());
+ }
+ }
+
+ removePendingMessages(IDs);
+}
- mPriv->pendingMessages.erase(i);
+void BaseChannelTextType::removePendingMessages(const UIntList &IDs)
+{
+ foreach (uint id, IDs) {
+ mPriv->pendingMessages.remove(id);
}
/* Signal on ChannelMessagesInterface */
@@ -579,7 +642,7 @@ struct TP_QT_NO_EXPORT BaseChannelMessagesInterface::Private {
/**
* \class BaseChannelMessagesInterface
- * \ingroup servicecm
+ * \ingroup servicechannel
* \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
*
* \brief Base class for implementations of Channel.Interface.Messages
@@ -657,7 +720,7 @@ uint BaseChannelMessagesInterface::deliveryReportingSupport()
return mPriv->deliveryReportingSupport;
}
-Tp::MessagePartListList BaseChannelMessagesInterface::pendingMessages()
+Tp::MessagePartListList BaseChannelMessagesInterface::pendingMessages() const
{
return mPriv->textTypeInterface->pendingMessages();
}
@@ -688,12 +751,26 @@ QString BaseChannelMessagesInterface::sendMessage(const Tp::MessagePartList &mes
error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
return QString();
}
- QString token = mPriv->sendMessageCB(message, flags, error);
+ const QString token = mPriv->sendMessageCB(message, flags, error);
+
+ Tp::MessagePartList fixedMessage = message;
+
+ MessagePart header = fixedMessage.front();
+
+ uint timestamp = 0;
+ if (header.contains(QLatin1String("message-sent"))) {
+ timestamp = header[QLatin1String("message-sent")].variant().toUInt();
+ } else {
+ timestamp = QDateTime::currentMSecsSinceEpoch() / 1000;
+ header[QLatin1String("message-sent")] = QDBusVariant(timestamp);
+ }
+
+ fixedMessage.replace(0, header);
//emit after return
QMetaObject::invokeMethod(mPriv->adaptee, "messageSent",
Qt::QueuedConnection,
- Q_ARG(Tp::MessagePartList, message),
+ Q_ARG(Tp::MessagePartList, fixedMessage),
Q_ARG(uint, flags),
Q_ARG(QString, token));
@@ -701,11 +778,6 @@ QString BaseChannelMessagesInterface::sendMessage(const Tp::MessagePartList &mes
warning() << "Sending empty message";
return token;
}
- const MessagePart &header = message.front();
-
- uint timestamp = 0;
- if (header.count(QLatin1String("message-received")))
- timestamp = header[QLatin1String("message-received")].variant().toUInt();
uint type = ChannelTextMessageTypeNormal;
if (header.count(QLatin1String("message-type")))
@@ -728,6 +800,956 @@ QString BaseChannelMessagesInterface::sendMessage(const Tp::MessagePartList &mes
return token;
}
+// Chan.T.FileTransfer
+// The BaseChannelFileTransferType code is fully or partially generated by the TelepathyQt-Generator.
+struct TP_QT_NO_EXPORT BaseChannelFileTransferType::Private {
+
+ Private(BaseChannelFileTransferType *parent,
+ const QVariantMap &request)
+ : state(Tp::FileTransferStatePending),
+ transferredBytes(0),
+ initialOffset(0),
+ deviceOffset(0),
+ device(nullptr),
+ weOpenedDevice(false),
+ serverSocket(nullptr),
+ clientSocket(nullptr),
+ adaptee(new BaseChannelFileTransferType::Adaptee(parent))
+ {
+ contentType = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentType")).toString();
+ filename = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Filename")).toString();
+ size = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Size")).toULongLong();
+ contentHashType = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentHashType")).toUInt();
+ contentHash = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentHash")).toString();
+ description = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Description")).toString();
+ qint64 dbusDataValue = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Date")).value<qint64>();
+ if (dbusDataValue != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
+ date.setTime_t(dbusDataValue);
+#else
+ date.setSecsSinceEpoch(dbusDataValue);
+#endif
+ }
+
+ if (request.contains(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".URI"))) {
+ uri = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".URI")).toString();
+ }
+
+ if (request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".Requested")).toBool()) {
+ direction = BaseChannelFileTransferType::Outgoing;
+ } else {
+ direction = BaseChannelFileTransferType::Incoming;
+ }
+ }
+
+ uint state;
+ QString contentType;
+ QString filename;
+ qulonglong size;
+ uint contentHashType;
+ QString contentHash;
+ QString description;
+ QDateTime date;
+ qulonglong transferredBytes;
+ qulonglong initialOffset;
+ qulonglong deviceOffset;
+ QString uri;
+ QString fileCollection;
+ QIODevice *device; // A socket to read or write file to underlying connection manager
+ bool weOpenedDevice;
+ QTcpServer *serverSocket; // Server socket is an implementation detail.
+ QIODevice *clientSocket; // A socket to communicate with a Telepathy client
+ BaseChannelFileTransferType::Direction direction;
+ BaseChannelFileTransferType::Adaptee *adaptee;
+
+ friend class BaseChannelFileTransferType::Adaptee;
+
+};
+
+BaseChannelFileTransferType::Adaptee::Adaptee(BaseChannelFileTransferType *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelFileTransferType::Adaptee::~Adaptee()
+{
+}
+
+uint BaseChannelFileTransferType::Adaptee::state() const
+{
+ return mInterface->state();
+}
+
+QString BaseChannelFileTransferType::Adaptee::contentType() const
+{
+ return mInterface->contentType();
+}
+
+QString BaseChannelFileTransferType::Adaptee::filename() const
+{
+ return mInterface->filename();
+}
+
+qulonglong BaseChannelFileTransferType::Adaptee::size() const
+{
+ return mInterface->size();
+}
+
+uint BaseChannelFileTransferType::Adaptee::contentHashType() const
+{
+ return mInterface->contentHashType();
+}
+
+QString BaseChannelFileTransferType::Adaptee::contentHash() const
+{
+ return mInterface->contentHash();
+}
+
+QString BaseChannelFileTransferType::Adaptee::description() const
+{
+ return mInterface->description();
+}
+
+qlonglong BaseChannelFileTransferType::Adaptee::date() const
+{
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
+ return mInterface->date().toTime_t();
+#else
+ return mInterface->date().toSecsSinceEpoch();
+#endif
+}
+
+Tp::SupportedSocketMap BaseChannelFileTransferType::Adaptee::availableSocketTypes() const
+{
+ return mInterface->availableSocketTypes();
+}
+
+qulonglong BaseChannelFileTransferType::Adaptee::transferredBytes() const
+{
+ return mInterface->transferredBytes();
+}
+
+qulonglong BaseChannelFileTransferType::Adaptee::initialOffset() const
+{
+ return mInterface->initialOffset();
+}
+
+QString BaseChannelFileTransferType::Adaptee::uri() const
+{
+ return mInterface->uri();
+}
+
+QString BaseChannelFileTransferType::Adaptee::fileCollection() const
+{
+ return mInterface->fileCollection();
+}
+
+void BaseChannelFileTransferType::Adaptee::setUri(const QString &uri)
+{
+ mInterface->setUri(uri);
+}
+
+void BaseChannelFileTransferType::Adaptee::acceptFile(uint addressType, uint accessControl, const QDBusVariant &accessControlParam, qulonglong offset,
+ const Tp::Service::ChannelTypeFileTransferAdaptor::AcceptFileContextPtr &context)
+{
+ debug() << "BaseChannelFileTransferType::Adaptee::acceptFile";
+
+ if (mInterface->mPriv->device) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_AVAILABLE, QLatin1String("File transfer can only be started once in the same channel"));
+ return;
+ }
+
+ DBusError error;
+ mInterface->createSocket(addressType, accessControl, accessControlParam, &error);
+
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+
+ QDBusVariant address = mInterface->socketAddress();
+
+ mInterface->setState(Tp::FileTransferStateAccepted, Tp::FileTransferStateChangeReasonNone);
+
+ mInterface->mPriv->initialOffset = offset;
+ QMetaObject::invokeMethod(this, "initialOffsetDefined", Q_ARG(qulonglong, offset));
+
+ context->setFinished(address);
+}
+
+void BaseChannelFileTransferType::Adaptee::provideFile(uint addressType, uint accessControl, const QDBusVariant &accessControlParam,
+ const Tp::Service::ChannelTypeFileTransferAdaptor::ProvideFileContextPtr &context)
+{
+ debug() << "BaseChannelFileTransferType::Adaptee::provideFile";
+
+ DBusError error;
+ mInterface->createSocket(addressType, accessControl, accessControlParam, &error);
+
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+
+ QDBusVariant address = mInterface->socketAddress();
+
+ mInterface->tryToOpenAndTransfer();
+ context->setFinished(address);
+}
+
+/**
+ * \class BaseChannelFileTransferType
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class of Channel.Type.FileTransfer channel type.
+ *
+ * Default implementation currently support only IPv4 and IPv6 sockets with localhost access control.
+ *
+ * Usage:
+ * -# Add FileTransfer to the list of the protocol requestable channel classes.
+ * -# Add FileTransfer to the list of the connection requestable channel classes.
+ * -# Setup ContactCapabilities interface and ensure that FileTransfer requestable channel class presence matches to
+ * actual local (!) and remote contacts capabilities.
+ * -# Implement initial FileTransfer channel support in createChannel callback.
+ * -# The channel of interest are those with channelType TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER.
+ * -# Create BaseChannel and plug BaseChannelFileTransferType interface.
+ * -# If transferInterface->direction() is Outgoing, notify the remote side.
+ * -# Implement incoming file request handler:
+ * -# Properly setup the request details, take care on TargetHandle and InitiatorHandle.
+ * -# Call BaseConnection::createChannel() with the details. Do not suppress handler!
+ * -# Use remoteProvideFile() to pass the input device and its offset.
+ * -# transferredBytes property will be updated automatically on bytes written to the client socket.
+ * -# Implement "remote side accepted transfer" handler:
+ * -# Use remoteAcceptFile() to pass the requested initial offset and output device.
+ * -# Update transferredBytes property on bytes written to the remote side.
+ *
+ * Incoming transfer process:
+ * -# Connection manager creates not requested channel with ChannelType = TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER and
+ * other properties, such as Filename, Size and ContentType.
+ * -# The channel initial state is Pending.
+ * -# At any time:
+ * -# Client calls AcceptFile method to configure the socket and request an initial offset. The implementation
+ * calls createSocket(), which should trigger (now or later) a call to setClientSocket() to setup the client
+ * socket. socketAddress() method used to return the socket address. This changes the state to Accepted.
+ * -# The connection manager calls remoteProvideFile() method to pass the input device and it's offset. The device
+ * offset is a number of bytes, already skipped by the device. The interface would skip remaining
+ * initialOffset - deviceOffset bytes.
+ * -# Client connects to the socket and triggers setClientSocket() call.
+ * -# The channel state is Open now.
+ * -# If the device is already ready to read, or emit readyRead() signal, the interface reads data from the device and
+ * write it to the clientSocket.
+ * -# Client socket emit bytesWritten() signal, the interface updates transferredBytes count.
+ * -# If transferredBytes == size, then the channel state changes to Completed.
+ * Otherwise the interface waits for further data from the device socket.
+ *
+ * Outgoing transfer process:
+ * -# Client requests a channel with ChannelType = TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER and other properties, such as
+ * Filename, Size and ContentType.
+ * -# Connection manager creates the requested channel with initial state Pending.
+ * -# Connection manager asks remote contact to accept the transfer.
+ * -# At any time:
+ * -# Remote contact accept file, connection manager calls remoteAcceptFile() method to pass the output device
+ * and an initial offset. This changes the state to Accepted.
+ * -# Client calls ProvideFile method to configure a socket. The implementation calls createSocket(), which should
+ * trigger (now or later) a call to setClientSocket() to setup the client socket. socketAddress() method used
+ * to return the socket address.
+ * -# Client connects to the socket and triggers setClientSocket() call.
+ * -# The channel state is Open now.
+ * -# Client writes data to the socket.
+ * -# The clientSocket emits readyRead() signal, the interface reads the data from the clientSocket and write it to the
+ * io device.
+ * -# Connection manager calls updates transferredBytes property on actual data write.
+ * -# If transferredBytes == size, then the channel state changes to Completed.
+ * Otherwise the interface waits for further data from the client socket.
+ *
+ * Subclassing:
+ * + Reimplement a public virtual method availableSocketTypes() to expose extra socket types.
+ * + Overload protected createSocket() method to provide own socket address type, access control and its param
+ * implementation.
+ * + Custom createSocket() implementation MUST be paired with custom socketAddress() method implementation.
+ * + Use setClientSocket() method to pass the client socket.
+ *
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelFileTransferType::BaseChannelFileTransferType(const QVariantMap &request)
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER),
+ mPriv(new Private(this, request))
+{
+}
+
+bool BaseChannelFileTransferType::createSocket(uint addressType, uint accessControl, const QDBusVariant &accessControlParam, Tp::DBusError *error)
+{
+ Q_UNUSED(accessControlParam);
+
+ if (accessControl != Tp::SocketAccessControlLocalhost) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Requested access control mechanism is not supported."));
+ return false;
+ }
+
+ QHostAddress address;
+
+ switch (addressType) {
+ case Tp::SocketAddressTypeIPv4:
+ address = QHostAddress(QHostAddress::LocalHost);
+ break;
+ case Tp::SocketAddressTypeIPv6:
+ address = QHostAddress(QHostAddress::LocalHostIPv6);
+ break;
+ default:
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Requested address type is not supported."));
+ return false;
+ }
+
+ if (mPriv->serverSocket) {
+ error->set(TP_QT_ERROR_NOT_AVAILABLE, QLatin1String("File transfer can only be started once in the same channel"));
+ return false;
+ }
+
+ mPriv->serverSocket = new QTcpServer(this);
+ mPriv->serverSocket->setMaxPendingConnections(1);
+
+ connect(mPriv->serverSocket, SIGNAL(newConnection()), this, SLOT(onSocketConnection()));
+
+ bool result = mPriv->serverSocket->listen(address);
+ if (!result) {
+ error->set(TP_QT_ERROR_NETWORK_ERROR, mPriv->serverSocket->errorString());
+ }
+
+ return result;
+}
+
+QDBusVariant BaseChannelFileTransferType::socketAddress() const
+{
+ if (!mPriv->serverSocket) {
+ return QDBusVariant();
+ }
+
+ switch (mPriv->serverSocket->serverAddress().protocol()) {
+ case QAbstractSocket::IPv4Protocol: {
+ SocketAddressIPv4 a;
+ a.address = mPriv->serverSocket->serverAddress().toString();
+ a.port = mPriv->serverSocket->serverPort();
+ return QDBusVariant(QVariant::fromValue(a));
+ }
+ case QAbstractSocket::IPv6Protocol: {
+ SocketAddressIPv6 a;
+ a.address = mPriv->serverSocket->serverAddress().toString();
+ a.port = mPriv->serverSocket->serverPort();
+ return QDBusVariant(QVariant::fromValue(a));
+ }
+ default:
+ break;
+ }
+
+ return QDBusVariant();
+}
+
+void BaseChannelFileTransferType::setTransferredBytes(qulonglong count)
+{
+ if (mPriv->transferredBytes == count) {
+ return;
+ }
+
+ mPriv->transferredBytes = count;
+ QMetaObject::invokeMethod(mPriv->adaptee, "transferredBytesChanged", Q_ARG(qulonglong, count)); //Can simply use emit in Qt5
+
+ if (transferredBytes() == size()) {
+ mPriv->clientSocket->close();
+ mPriv->serverSocket->close();
+ setState(Tp::FileTransferStateCompleted, Tp::FileTransferStateChangeReasonNone);
+ }
+}
+
+void BaseChannelFileTransferType::setClientSocket(QIODevice *socket)
+{
+ mPriv->clientSocket = socket;
+
+ if (!socket) {
+ warning() << "BaseChannelFileTransferType::setClientSocket() called with a null socket.";
+ return;
+ }
+
+ switch (mPriv->direction) {
+ case BaseChannelFileTransferType::Outgoing:
+ connect(mPriv->clientSocket, SIGNAL(readyRead()), this, SLOT(doTransfer()));
+ break;
+ case BaseChannelFileTransferType::Incoming:
+ connect(mPriv->clientSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(onBytesWritten(qint64)));
+ break;
+ default:
+ // Should not be ever possible
+ Q_ASSERT(0);
+ break;
+ }
+
+ tryToOpenAndTransfer();
+}
+
+void BaseChannelFileTransferType::onSocketConnection()
+{
+ setClientSocket(mPriv->serverSocket->nextPendingConnection());
+}
+
+void BaseChannelFileTransferType::doTransfer()
+{
+ if (!mPriv->clientSocket || !mPriv->device) {
+ return;
+ }
+
+ QIODevice *input = nullptr;
+ QIODevice *output = nullptr;
+
+ switch (mPriv->direction) {
+ case BaseChannelFileTransferType::Outgoing:
+ input = mPriv->clientSocket;
+ output = mPriv->device;
+ break;
+ case BaseChannelFileTransferType::Incoming:
+ input = mPriv->device;
+ output = mPriv->clientSocket;
+ break;
+ default:
+ // Should not be ever possible
+ Q_ASSERT(0);
+ break;
+ }
+
+ static const int c_blockSize = 16 * 1024;
+ char buffer[c_blockSize];
+ char *inputPointer = buffer;
+
+ qint64 length = input->read(buffer, sizeof(buffer));
+
+ if (length) {
+ // deviceOffset is the number of already skipped bytes
+ if (mPriv->deviceOffset + length > initialOffset()) {
+ if (mPriv->deviceOffset < initialOffset()) {
+ qint64 diff = initialOffset() - mPriv->deviceOffset;
+ length -= diff;
+ inputPointer += diff;
+ mPriv->deviceOffset += diff;
+ }
+ output->write(inputPointer, length);
+ }
+ mPriv->deviceOffset += length;
+ }
+
+ if (input->bytesAvailable() > 0) {
+ QMetaObject::invokeMethod(this, "doTransfer", Qt::QueuedConnection);
+ }
+}
+
+void BaseChannelFileTransferType::onBytesWritten(qint64 count)
+{
+ setTransferredBytes(transferredBytes() + count);
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelFileTransferType::~BaseChannelFileTransferType()
+{
+ delete mPriv;
+}
+
+/**
+ * Return the immutable properties of this interface.
+ *
+ * Immutable properties cannot change after the interface has been registered
+ * on a service on the bus with registerInterface().
+ *
+ * \return The immutable properties of this interface.
+ */
+QVariantMap BaseChannelFileTransferType::immutableProperties() const
+{
+ QVariantMap map;
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentType"),
+ QVariant::fromValue(contentType()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Filename"),
+ QVariant::fromValue(filename()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Size"),
+ QVariant::fromValue(size()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentHashType"),
+ QVariant::fromValue(contentHashType()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentHash"),
+ QVariant::fromValue(contentHash()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Description"),
+ QVariant::fromValue(description()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Date"),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
+ QVariant::fromValue(date().toTime_t()));
+#else
+ QVariant::fromValue(date().toSecsSinceEpoch()));
+#endif
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".AvailableSocketTypes"),
+ QVariant::fromValue(availableSocketTypes()));
+
+ if (mPriv->direction == Outgoing) {
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".URI"), QVariant::fromValue(uri()));
+ }
+
+ return map;
+}
+
+BaseChannelFileTransferType::Direction BaseChannelFileTransferType::direction() const
+{
+ return mPriv->direction;
+}
+
+uint BaseChannelFileTransferType::state() const
+{
+ return mPriv->state;
+}
+
+void BaseChannelFileTransferType::setState(uint state, uint reason)
+{
+ if (mPriv->state == state) {
+ return;
+ }
+
+ mPriv->state = state;
+ QMetaObject::invokeMethod(mPriv->adaptee, "fileTransferStateChanged", Q_ARG(uint, state), Q_ARG(uint, reason)); //Can simply use emit in Qt5
+ emit stateChanged(state, reason);
+}
+
+QString BaseChannelFileTransferType::contentType() const
+{
+ return mPriv->contentType;
+}
+
+QString BaseChannelFileTransferType::filename() const
+{
+ return mPriv->filename;
+}
+
+qulonglong BaseChannelFileTransferType::size() const
+{
+ return mPriv->size;
+}
+
+uint BaseChannelFileTransferType::contentHashType() const
+{
+ return mPriv->contentHashType;
+}
+
+QString BaseChannelFileTransferType::contentHash() const
+{
+ return mPriv->contentHash;
+}
+
+QString BaseChannelFileTransferType::description() const
+{
+ return mPriv->description;
+}
+
+QDateTime BaseChannelFileTransferType::date() const
+{
+ return mPriv->date;
+}
+
+Tp::SupportedSocketMap BaseChannelFileTransferType::availableSocketTypes() const
+{
+ Tp::SupportedSocketMap types;
+ types.insert(Tp::SocketAddressTypeIPv4, Tp::UIntList() << Tp::SocketAccessControlLocalhost);
+
+ return types;
+}
+
+qulonglong BaseChannelFileTransferType::transferredBytes() const
+{
+ return mPriv->transferredBytes;
+}
+
+qulonglong BaseChannelFileTransferType::initialOffset() const
+{
+ return mPriv->initialOffset;
+}
+
+QString BaseChannelFileTransferType::uri() const
+{
+ return mPriv->uri;
+}
+
+void BaseChannelFileTransferType::setUri(const QString &uri)
+{
+ if (mPriv->direction == Outgoing) {
+ warning() << "BaseChannelFileTransferType::setUri(): Failed to set URI property for outgoing transfer.";
+ return;
+ }
+
+ // The property can be written only before AcceptFile.
+ if (state() != FileTransferStatePending) {
+ warning() << "BaseChannelFileTransferType::setUri(): Failed to set URI property after AcceptFile call.";
+ return;
+ }
+
+ mPriv->uri = uri;
+ QMetaObject::invokeMethod(mPriv->adaptee, "uriDefined", Q_ARG(QString, uri)); //Can simply use emit in Qt5
+ emit uriDefined(uri);
+}
+QString BaseChannelFileTransferType::fileCollection() const
+{
+ return mPriv->fileCollection;
+}
+
+void BaseChannelFileTransferType::setFileCollection(const QString &fileCollection)
+{
+ mPriv->fileCollection = fileCollection;
+}
+
+void BaseChannelFileTransferType::createAdaptor()
+{
+ (void) new Tp::Service::ChannelTypeFileTransferAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+bool BaseChannelFileTransferType::remoteAcceptFile(QIODevice *output, qulonglong offset)
+{
+ QString errorText;
+ bool deviceIsAlreadynOpened = output && output->isOpen();
+
+ if (!output) {
+ errorText = QLatin1String("The device must not be null.");
+ goto errorLabel;
+ }
+
+ if (mPriv->state != Tp::FileTransferStatePending) {
+ errorText = QLatin1String("The state should be Pending.");
+ goto errorLabel;
+ }
+
+ if (mPriv->direction != Outgoing) {
+ errorText = QLatin1String("The direction should be Outgoing.");
+ goto errorLabel;
+ }
+
+ if (offset > size()) {
+ errorText = QLatin1String("The offset should be less than the size.");
+ goto errorLabel;
+ }
+
+ if (mPriv->device) {
+ errorText = QLatin1String("The device is already set.");
+ goto errorLabel;
+ }
+
+ if (!deviceIsAlreadynOpened) {
+ if (!output->open(QIODevice::WriteOnly)) {
+ errorText = QLatin1String("Unable to open the device .");
+ goto errorLabel;
+ }
+
+ if (!output->isSequential()) {
+ if (!output->seek(offset)) {
+ errorText = QLatin1String("Unable to seek the device to the offset.");
+ goto errorLabel;
+ }
+ }
+ }
+
+ if (!output->isWritable()) {
+ errorText = QLatin1String("The device is not writable.");
+ goto errorLabel;
+ }
+
+ if (!errorText.isEmpty()) {
+ errorLabel:
+ warning() << "BaseChannelFileTransferType::remoteAcceptFile(): Invalid call:" << errorText;
+ setState(Tp::FileTransferStateCancelled, Tp::FileTransferStateChangeReasonLocalError);
+
+ return false;
+ }
+
+ mPriv->device = output;
+ mPriv->deviceOffset = offset;
+ mPriv->weOpenedDevice = !deviceIsAlreadynOpened;
+ mPriv->initialOffset = offset;
+
+ QMetaObject::invokeMethod(mPriv->adaptee, "initialOffsetDefined", Q_ARG(qulonglong, offset)); //Can simply use emit in Qt5
+ setState(Tp::FileTransferStateAccepted, Tp::FileTransferStateChangeReasonNone);
+
+ return true;
+}
+
+/*!
+ *
+ * Connection manager should call this method to pass the input device and its offset.
+ * The interface would skip remaining initialOffset - deviceOffset bytes.
+ *
+ * \param input The input device
+ * \param deviceOffset The number of bytes, already skipped by the device.
+ *
+ * \return True if success, false otherwise.
+ */
+bool BaseChannelFileTransferType::remoteProvideFile(QIODevice *input, qulonglong deviceOffset)
+{
+ QString errorText;
+ bool deviceIsAlreadyOpened = input && input->isOpen();
+
+ if (!input) {
+ errorText = QLatin1String("The device must not be null.");
+ goto errorLabel;
+ }
+
+ switch (mPriv->state) {
+ case Tp::FileTransferStatePending:
+ case Tp::FileTransferStateAccepted:
+ break;
+ default:
+ errorText = QLatin1String("The state should be Pending or Accepted.");
+ goto errorLabel;
+ break;
+ }
+
+ if (mPriv->direction != Incoming) {
+ errorText = QLatin1String("The direction should be Incoming.");
+ goto errorLabel;
+ }
+
+ if (deviceOffset > initialOffset()) {
+ errorText = QLatin1String("The deviceOffset should be less or equal to the initialOffset.");
+ goto errorLabel;
+ }
+
+ if (mPriv->device) {
+ errorText = QLatin1String("The device is already set.");
+ goto errorLabel;
+ }
+
+ if (!deviceIsAlreadyOpened) {
+ if (!input->open(QIODevice::ReadOnly)) {
+ errorText = QLatin1String("Unable to open the device .");
+ goto errorLabel;
+ }
+
+ if (!input->isSequential()) {
+ if (!input->seek(initialOffset())) {
+ errorText = QLatin1String("Unable to seek the device to the initial offset.");
+ goto errorLabel;
+ }
+ deviceOffset = initialOffset();
+ }
+ }
+
+ if (!input->isReadable()) {
+ errorText = QLatin1String("The device is not readable.");
+ goto errorLabel;
+ }
+
+ if (!errorText.isEmpty()) {
+ errorLabel:
+ warning() << "BaseChannelFileTransferType::remoteProvideFile(): Invalid call:" << errorText;
+ setState(Tp::FileTransferStateCancelled, Tp::FileTransferStateChangeReasonLocalError);
+
+ return false;
+ }
+
+ mPriv->deviceOffset = deviceOffset;
+
+ mPriv->device = input;
+ mPriv->weOpenedDevice = !deviceIsAlreadyOpened;
+
+ connect(mPriv->device, SIGNAL(readyRead()), this, SLOT(doTransfer()));
+
+ tryToOpenAndTransfer();
+
+ return true;
+}
+
+void BaseChannelFileTransferType::tryToOpenAndTransfer()
+{
+ if (state() == Tp::FileTransferStateAccepted) {
+ setState(Tp::FileTransferStateOpen, Tp::FileTransferStateChangeReasonNone);
+ setTransferredBytes(initialOffset());
+ }
+
+ if (state() == Tp::FileTransferStateOpen) {
+ if (mPriv->clientSocket && mPriv->device) {
+ QMetaObject::invokeMethod(this, "doTransfer", Qt::QueuedConnection);
+
+ }
+ }
+}
+
+void BaseChannelFileTransferType::close()
+{
+ uint transferState = state();
+ if (transferState == FileTransferStatePending ||
+ transferState == FileTransferStateAccepted ||
+ transferState == FileTransferStateOpen) {
+ // The file transfer was cancelled
+ setState(Tp::FileTransferStateCancelled, Tp::FileTransferStateChangeReasonLocalStopped);
+ }
+}
+
+// Chan.T.RoomList
+// The BaseChannelRoomListType code is fully or partially generated by the TelepathyQt-Generator.
+struct TP_QT_NO_EXPORT BaseChannelRoomListType::Private {
+ Private(BaseChannelRoomListType *parent,
+ const QString &server)
+ : server(server),
+ listingRooms(false),
+ adaptee(new BaseChannelRoomListType::Adaptee(parent))
+ {
+ }
+
+ QString server;
+ bool listingRooms;
+ ListRoomsCallback listRoomsCB;
+ StopListingCallback stopListingCB;
+ BaseChannelRoomListType::Adaptee *adaptee;
+};
+
+BaseChannelRoomListType::Adaptee::Adaptee(BaseChannelRoomListType *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelRoomListType::Adaptee::~Adaptee()
+{
+}
+
+QString BaseChannelRoomListType::Adaptee::server() const
+{
+ return mInterface->server();
+}
+
+void BaseChannelRoomListType::Adaptee::getListingRooms(
+ const Tp::Service::ChannelTypeRoomListAdaptor::GetListingRoomsContextPtr &context)
+{
+ context->setFinished(mInterface->getListingRooms());
+}
+
+void BaseChannelRoomListType::Adaptee::listRooms(
+ const Tp::Service::ChannelTypeRoomListAdaptor::ListRoomsContextPtr &context)
+{
+ debug() << "BaseChannelRoomListType::Adaptee::listRooms";
+ DBusError error;
+ mInterface->listRooms(&error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseChannelRoomListType::Adaptee::stopListing(
+ const Tp::Service::ChannelTypeRoomListAdaptor::StopListingContextPtr &context)
+{
+ debug() << "BaseChannelRoomListType::Adaptee::stopListing";
+ DBusError error;
+ mInterface->stopListing(&error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+/**
+ * \class BaseChannelRoomListType
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Type.RoomList
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelRoomListType::BaseChannelRoomListType(const QString &server)
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_TYPE_ROOM_LIST),
+ mPriv(new Private(this, server))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelRoomListType::~BaseChannelRoomListType()
+{
+ delete mPriv;
+}
+
+/**
+ * Return the immutable properties of this interface.
+ *
+ * Immutable properties cannot change after the interface has been registered
+ * on a service on the bus with registerInterface().
+ *
+ * \return The immutable properties of this interface.
+ */
+QVariantMap BaseChannelRoomListType::immutableProperties() const
+{
+ QVariantMap map;
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_ROOM_LIST + QLatin1String(".Server"),
+ QVariant::fromValue(mPriv->adaptee->server()));
+ return map;
+}
+
+QString BaseChannelRoomListType::server() const
+{
+ return mPriv->server;
+}
+
+void BaseChannelRoomListType::createAdaptor()
+{
+ (void) new Tp::Service::ChannelTypeRoomListAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+bool BaseChannelRoomListType::getListingRooms()
+{
+ return mPriv->listingRooms;
+}
+
+void BaseChannelRoomListType::setListingRooms(bool listing)
+{
+ if (mPriv->listingRooms == listing) {
+ return;
+ }
+
+ mPriv->listingRooms = listing;
+ QMetaObject::invokeMethod(mPriv->adaptee, "listingRooms", Q_ARG(bool, listing)); //Can simply use emit in Qt5
+}
+
+void BaseChannelRoomListType::setListRoomsCallback(const ListRoomsCallback &cb)
+{
+ mPriv->listRoomsCB = cb;
+}
+
+void BaseChannelRoomListType::listRooms(DBusError *error)
+{
+ if (!mPriv->listRoomsCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->listRoomsCB(error);
+}
+
+void BaseChannelRoomListType::setStopListingCallback(const StopListingCallback &cb)
+{
+ mPriv->stopListingCB = cb;
+}
+
+void BaseChannelRoomListType::stopListing(DBusError *error)
+{
+ if (!mPriv->stopListingCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->stopListingCB(error);
+}
+
+void BaseChannelRoomListType::gotRooms(const Tp::RoomInfoList &rooms)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "gotRooms", Q_ARG(Tp::RoomInfoList, rooms)); //Can simply use emit in Qt5
+}
//Chan.T.ServerAuthentication
BaseChannelServerAuthenticationType::Adaptee::Adaptee(BaseChannelServerAuthenticationType *interface)
@@ -756,7 +1778,7 @@ QString BaseChannelServerAuthenticationType::Adaptee::authenticationMethod() con
/**
* \class BaseChannelServerAuthenticationType
- * \ingroup servicecm
+ * \ingroup servicechannel
* \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
*
* \brief Base class for implementations of Channel.Type.ServerAuthentifcation
@@ -852,7 +1874,7 @@ QVariantMap BaseChannelCaptchaAuthenticationInterface::Adaptee::captchaErrorDeta
void BaseChannelCaptchaAuthenticationInterface::Adaptee::getCaptchas(const Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::GetCaptchasContextPtr &context)
{
- qDebug() << "BaseChannelCaptchaAuthenticationInterface::Adaptee::getCaptchas";
+ debug() << "BaseChannelCaptchaAuthenticationInterface::Adaptee::getCaptchas";
DBusError error;
Tp::CaptchaInfoList captchaInfo;
uint numberRequired;
@@ -867,7 +1889,7 @@ void BaseChannelCaptchaAuthenticationInterface::Adaptee::getCaptchas(const Tp::S
void BaseChannelCaptchaAuthenticationInterface::Adaptee::getCaptchaData(uint ID, const QString& mimeType, const Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::GetCaptchaDataContextPtr &context)
{
- qDebug() << "BaseChannelCaptchaAuthenticationInterface::Adaptee::getCaptchaData " << ID << mimeType;
+ debug() << "BaseChannelCaptchaAuthenticationInterface::Adaptee::getCaptchaData " << ID << mimeType;
DBusError error;
QByteArray captchaData = mInterface->mPriv->getCaptchaDataCB(ID, mimeType, &error);
if (error.isValid()) {
@@ -879,7 +1901,7 @@ void BaseChannelCaptchaAuthenticationInterface::Adaptee::getCaptchaData(uint ID,
void BaseChannelCaptchaAuthenticationInterface::Adaptee::answerCaptchas(const Tp::CaptchaAnswers& answers, const Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::AnswerCaptchasContextPtr &context)
{
- qDebug() << "BaseChannelCaptchaAuthenticationInterface::Adaptee::answerCaptchas";
+ debug() << "BaseChannelCaptchaAuthenticationInterface::Adaptee::answerCaptchas";
DBusError error;
mInterface->mPriv->answerCaptchasCB(answers, &error);
if (error.isValid()) {
@@ -891,7 +1913,7 @@ void BaseChannelCaptchaAuthenticationInterface::Adaptee::answerCaptchas(const Tp
void BaseChannelCaptchaAuthenticationInterface::Adaptee::cancelCaptcha(uint reason, const QString& debugMessage, const Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::CancelCaptchaContextPtr &context)
{
- qDebug() << "BaseChannelCaptchaAuthenticationInterface::Adaptee::cancelCaptcha "
+ debug() << "BaseChannelCaptchaAuthenticationInterface::Adaptee::cancelCaptcha "
<< reason << " " << debugMessage;
DBusError error;
mInterface->mPriv->cancelCaptchaCB(reason, debugMessage, &error);
@@ -904,7 +1926,7 @@ void BaseChannelCaptchaAuthenticationInterface::Adaptee::cancelCaptcha(uint reas
/**
* \class BaseChannelCaptchaAuthenticationInterface
- * \ingroup servicecm
+ * \ingroup servicechannel
* \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
*
* \brief Base class for implementations of Channel.Interface.CaptchaAuthentication
@@ -939,7 +1961,7 @@ BaseChannelCaptchaAuthenticationInterface::~BaseChannelCaptchaAuthenticationInte
QVariantMap BaseChannelCaptchaAuthenticationInterface::immutableProperties() const
{
QVariantMap map;
- map.insert(TP_QT_IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION + QLatin1String(".CanRetryCaptcha"),
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_CAPTCHA_AUTHENTICATION + QLatin1String(".CanRetryCaptcha"),
QVariant::fromValue(mPriv->adaptee->canRetryCaptcha()));
return map;
}
@@ -973,99 +1995,1865 @@ void BaseChannelCaptchaAuthenticationInterface::setCancelCaptchaCallback(const C
void BaseChannelCaptchaAuthenticationInterface::setCaptchaStatus(uint status)
{
mPriv->captchaStatus = status;
+ notifyPropertyChanged(QLatin1String("CaptchaStatus"), QVariant::fromValue(status));
}
void BaseChannelCaptchaAuthenticationInterface::setCaptchaError(const QString& busName)
{
mPriv->captchaError = busName;
+ notifyPropertyChanged(QLatin1String("CaptchaError"), QVariant::fromValue(busName));
}
void BaseChannelCaptchaAuthenticationInterface::setCaptchaErrorDetails(const QVariantMap& error)
{
mPriv->captchaErrorDetails = error;
+ notifyPropertyChanged(QLatin1String("CaptchaErrorDetails"), QVariant::fromValue(error));
}
-//Chan.I.Group
-BaseChannelGroupInterface::Adaptee::Adaptee(BaseChannelGroupInterface *interface)
+// Chan.I.SASLAuthentication
+// The BaseChannelSASLAuthenticationInterface code is fully or partially generated by the TelepathyQt-Generator.
+struct TP_QT_NO_EXPORT BaseChannelSASLAuthenticationInterface::Private {
+ Private(BaseChannelSASLAuthenticationInterface *parent,
+ const QStringList &availableMechanisms,
+ bool hasInitialData,
+ bool canTryAgain,
+ const QString &authorizationIdentity,
+ const QString &defaultUsername,
+ const QString &defaultRealm,
+ bool maySaveResponse)
+ : availableMechanisms(availableMechanisms),
+ hasInitialData(hasInitialData),
+ canTryAgain(canTryAgain),
+ saslStatus(0),
+ authorizationIdentity(authorizationIdentity),
+ defaultUsername(defaultUsername),
+ defaultRealm(defaultRealm),
+ maySaveResponse(maySaveResponse),
+ adaptee(new BaseChannelSASLAuthenticationInterface::Adaptee(parent))
+ {
+ }
+
+ QStringList availableMechanisms;
+ bool hasInitialData;
+ bool canTryAgain;
+ uint saslStatus;
+ QString saslError;
+ QVariantMap saslErrorDetails;
+ QString authorizationIdentity;
+ QString defaultUsername;
+ QString defaultRealm;
+ bool maySaveResponse;
+ StartMechanismCallback startMechanismCB;
+ StartMechanismWithDataCallback startMechanismWithDataCB;
+ RespondCallback respondCB;
+ AcceptSASLCallback acceptSaslCB;
+ AbortSASLCallback abortSaslCB;
+ BaseChannelSASLAuthenticationInterface::Adaptee *adaptee;
+};
+
+BaseChannelSASLAuthenticationInterface::Adaptee::Adaptee(BaseChannelSASLAuthenticationInterface *interface)
: QObject(interface),
mInterface(interface)
{
}
-BaseChannelGroupInterface::Adaptee::~Adaptee()
+BaseChannelSASLAuthenticationInterface::Adaptee::~Adaptee()
+{
+}
+
+QStringList BaseChannelSASLAuthenticationInterface::Adaptee::availableMechanisms() const
+{
+ return mInterface->availableMechanisms();
+}
+
+bool BaseChannelSASLAuthenticationInterface::Adaptee::hasInitialData() const
+{
+ return mInterface->hasInitialData();
+}
+
+bool BaseChannelSASLAuthenticationInterface::Adaptee::canTryAgain() const
+{
+ return mInterface->canTryAgain();
+}
+
+uint BaseChannelSASLAuthenticationInterface::Adaptee::saslStatus() const
+{
+ return mInterface->saslStatus();
+}
+
+QString BaseChannelSASLAuthenticationInterface::Adaptee::saslError() const
+{
+ return mInterface->saslError();
+}
+
+QVariantMap BaseChannelSASLAuthenticationInterface::Adaptee::saslErrorDetails() const
+{
+ return mInterface->saslErrorDetails();
+}
+
+QString BaseChannelSASLAuthenticationInterface::Adaptee::authorizationIdentity() const
+{
+ return mInterface->authorizationIdentity();
+}
+
+QString BaseChannelSASLAuthenticationInterface::Adaptee::defaultUsername() const
+{
+ return mInterface->defaultUsername();
+}
+
+QString BaseChannelSASLAuthenticationInterface::Adaptee::defaultRealm() const
+{
+ return mInterface->defaultRealm();
+}
+
+bool BaseChannelSASLAuthenticationInterface::Adaptee::maySaveResponse() const
+{
+ return mInterface->maySaveResponse();
+}
+
+void BaseChannelSASLAuthenticationInterface::Adaptee::startMechanism(const QString &mechanism,
+ const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::StartMechanismContextPtr &context)
+{
+ debug() << "BaseChannelSASLAuthenticationInterface::Adaptee::startMechanism";
+ DBusError error;
+ mInterface->startMechanism(mechanism, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseChannelSASLAuthenticationInterface::Adaptee::startMechanismWithData(const QString &mechanism, const QByteArray &initialData,
+ const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::StartMechanismWithDataContextPtr &context)
+{
+ debug() << "BaseChannelSASLAuthenticationInterface::Adaptee::startMechanismWithData";
+ DBusError error;
+ mInterface->startMechanismWithData(mechanism, initialData, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseChannelSASLAuthenticationInterface::Adaptee::respond(const QByteArray &responseData,
+ const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::RespondContextPtr &context)
+{
+ debug() << "BaseChannelSASLAuthenticationInterface::Adaptee::respond";
+ DBusError error;
+ mInterface->respond(responseData, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseChannelSASLAuthenticationInterface::Adaptee::acceptSasl(
+ const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::AcceptSASLContextPtr &context)
+{
+ debug() << "BaseChannelSASLAuthenticationInterface::Adaptee::acceptSasl";
+ DBusError error;
+ mInterface->acceptSasl(&error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseChannelSASLAuthenticationInterface::Adaptee::abortSasl(uint reason, const QString &debugMessage,
+ const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::AbortSASLContextPtr &context)
+{
+ debug() << "BaseChannelSASLAuthenticationInterface::Adaptee::abortSasl";
+ DBusError error;
+ mInterface->abortSasl(reason, debugMessage, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+/**
+ * \class BaseChannelSASLAuthenticationInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Interface.SASLAuthentication
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelSASLAuthenticationInterface::BaseChannelSASLAuthenticationInterface(const QStringList &availableMechanisms,
+ bool hasInitialData,
+ bool canTryAgain,
+ const QString &authorizationIdentity,
+ const QString &defaultUsername,
+ const QString &defaultRealm,
+ bool maySaveResponse)
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION),
+ mPriv(new Private(this, availableMechanisms, hasInitialData, canTryAgain, authorizationIdentity, defaultUsername, defaultRealm, maySaveResponse))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelSASLAuthenticationInterface::~BaseChannelSASLAuthenticationInterface()
+{
+ delete mPriv;
+}
+
+/**
+ * Return the immutable properties of this interface.
+ *
+ * Immutable properties cannot change after the interface has been registered
+ * on a service on the bus with registerInterface().
+ *
+ * \return The immutable properties of this interface.
+ */
+QVariantMap BaseChannelSASLAuthenticationInterface::immutableProperties() const
+{
+ QVariantMap map;
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION + QLatin1String(".AvailableMechanisms"),
+ QVariant::fromValue(mPriv->adaptee->availableMechanisms()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION + QLatin1String(".HasInitialData"),
+ QVariant::fromValue(mPriv->adaptee->hasInitialData()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION + QLatin1String(".CanTryAgain"),
+ QVariant::fromValue(mPriv->adaptee->canTryAgain()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION + QLatin1String(".AuthorizationIdentity"),
+ QVariant::fromValue(mPriv->adaptee->authorizationIdentity()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION + QLatin1String(".DefaultUsername"),
+ QVariant::fromValue(mPriv->adaptee->defaultUsername()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION + QLatin1String(".DefaultRealm"),
+ QVariant::fromValue(mPriv->adaptee->defaultRealm()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION + QLatin1String(".MaySaveResponse"),
+ QVariant::fromValue(mPriv->adaptee->maySaveResponse()));
+ return map;
+}
+
+QStringList BaseChannelSASLAuthenticationInterface::availableMechanisms() const
+{
+ return mPriv->availableMechanisms;
+}
+
+bool BaseChannelSASLAuthenticationInterface::hasInitialData() const
+{
+ return mPriv->hasInitialData;
+}
+
+bool BaseChannelSASLAuthenticationInterface::canTryAgain() const
+{
+ return mPriv->canTryAgain;
+}
+
+uint BaseChannelSASLAuthenticationInterface::saslStatus() const
+{
+ return mPriv->saslStatus;
+}
+
+void BaseChannelSASLAuthenticationInterface::setSaslStatus(uint status, const QString &reason, const QVariantMap &details)
+{
+ mPriv->saslStatus = status;
+ mPriv->saslError = reason;
+ mPriv->saslErrorDetails = details;
+ QMetaObject::invokeMethod(mPriv->adaptee, "saslStatusChanged", Q_ARG(uint, status), Q_ARG(QString, reason), Q_ARG(QVariantMap, details)); //Can simply use emit in Qt5
+}
+
+QString BaseChannelSASLAuthenticationInterface::saslError() const
+{
+ return mPriv->saslError;
+}
+
+void BaseChannelSASLAuthenticationInterface::setSaslError(const QString &saslError)
+{
+ mPriv->saslError = saslError;
+}
+
+QVariantMap BaseChannelSASLAuthenticationInterface::saslErrorDetails() const
+{
+ return mPriv->saslErrorDetails;
+}
+
+void BaseChannelSASLAuthenticationInterface::setSaslErrorDetails(const QVariantMap &saslErrorDetails)
+{
+ mPriv->saslErrorDetails = saslErrorDetails;
+}
+
+QString BaseChannelSASLAuthenticationInterface::authorizationIdentity() const
+{
+ return mPriv->authorizationIdentity;
+}
+
+QString BaseChannelSASLAuthenticationInterface::defaultUsername() const
+{
+ return mPriv->defaultUsername;
+}
+
+QString BaseChannelSASLAuthenticationInterface::defaultRealm() const
+{
+ return mPriv->defaultRealm;
+}
+
+bool BaseChannelSASLAuthenticationInterface::maySaveResponse() const
+{
+ return mPriv->maySaveResponse;
+}
+
+void BaseChannelSASLAuthenticationInterface::createAdaptor()
+{
+ (void) new Service::ChannelInterfaceSASLAuthenticationAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+void BaseChannelSASLAuthenticationInterface::setStartMechanismCallback(const BaseChannelSASLAuthenticationInterface::StartMechanismCallback &cb)
+{
+ mPriv->startMechanismCB = cb;
+}
+
+void BaseChannelSASLAuthenticationInterface::startMechanism(const QString &mechanism, DBusError *error)
+{
+ if (!mPriv->startMechanismCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->startMechanismCB(mechanism, error);
+}
+
+void BaseChannelSASLAuthenticationInterface::setStartMechanismWithDataCallback(const BaseChannelSASLAuthenticationInterface::StartMechanismWithDataCallback &cb)
+{
+ mPriv->startMechanismWithDataCB = cb;
+}
+
+void BaseChannelSASLAuthenticationInterface::startMechanismWithData(const QString &mechanism, const QByteArray &initialData, DBusError *error)
+{
+ if (!mPriv->startMechanismWithDataCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->startMechanismWithDataCB(mechanism, initialData, error);
+}
+
+void BaseChannelSASLAuthenticationInterface::setRespondCallback(const BaseChannelSASLAuthenticationInterface::RespondCallback &cb)
{
+ mPriv->respondCB = cb;
}
+void BaseChannelSASLAuthenticationInterface::respond(const QByteArray &responseData, DBusError *error)
+{
+ if (!mPriv->respondCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->respondCB(responseData, error);
+}
+
+void BaseChannelSASLAuthenticationInterface::setAcceptSaslCallback(const BaseChannelSASLAuthenticationInterface::AcceptSASLCallback &cb)
+{
+ mPriv->acceptSaslCB = cb;
+}
+
+void BaseChannelSASLAuthenticationInterface::acceptSasl(DBusError *error)
+{
+ if (!mPriv->acceptSaslCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->acceptSaslCB(error);
+}
+
+void BaseChannelSASLAuthenticationInterface::setAbortSaslCallback(const BaseChannelSASLAuthenticationInterface::AbortSASLCallback &cb)
+{
+ mPriv->abortSaslCB = cb;
+}
+
+void BaseChannelSASLAuthenticationInterface::abortSasl(uint reason, const QString &debugMessage, DBusError *error)
+{
+ if (!mPriv->abortSaslCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->abortSaslCB(reason, debugMessage, error);
+}
+
+void BaseChannelSASLAuthenticationInterface::newChallenge(const QByteArray &challengeData)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "newChallenge", Q_ARG(QByteArray, challengeData)); //Can simply use emit in Qt5
+}
+
+// Chan.I.Securable
+struct TP_QT_NO_EXPORT BaseChannelSecurableInterface::Private {
+ Private(BaseChannelSecurableInterface *parent)
+ : encrypted(false),
+ verified(false),
+ adaptee(new BaseChannelSecurableInterface::Adaptee(parent))
+ {
+ }
+
+ bool encrypted;
+ bool verified;
+ BaseChannelSecurableInterface::Adaptee *adaptee;
+};
+
+BaseChannelSecurableInterface::Adaptee::Adaptee(BaseChannelSecurableInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelSecurableInterface::Adaptee::~Adaptee()
+{
+}
+
+bool BaseChannelSecurableInterface::Adaptee::encrypted() const
+{
+ return mInterface->encrypted();
+}
+
+bool BaseChannelSecurableInterface::Adaptee::verified() const
+{
+ return mInterface->verified();
+}
+
+/**
+ * \class BaseChannelSecurableInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Interface.Securable
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelSecurableInterface::BaseChannelSecurableInterface()
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_SECURABLE),
+ mPriv(new Private(this))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelSecurableInterface::~BaseChannelSecurableInterface()
+{
+ delete mPriv;
+}
+
+/**
+ * Return the immutable properties of this interface.
+ *
+ * Immutable properties cannot change after the interface has been registered
+ * on a service on the bus with registerInterface().
+ *
+ * \return The immutable properties of this interface.
+ */
+QVariantMap BaseChannelSecurableInterface::immutableProperties() const
+{
+ QVariantMap map;
+ return map;
+}
+
+bool BaseChannelSecurableInterface::encrypted() const
+{
+ return mPriv->encrypted;
+}
+
+void BaseChannelSecurableInterface::setEncrypted(bool encrypted)
+{
+ mPriv->encrypted = encrypted;
+}
+
+bool BaseChannelSecurableInterface::verified() const
+{
+ return mPriv->verified;
+}
+
+void BaseChannelSecurableInterface::setVerified(bool verified)
+{
+ mPriv->verified = verified;
+}
+
+void BaseChannelSecurableInterface::createAdaptor()
+{
+ (void) new Service::ChannelInterfaceSecurableAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+// Chan.I.ChatState
+struct TP_QT_NO_EXPORT BaseChannelChatStateInterface::Private {
+ Private(BaseChannelChatStateInterface *parent)
+ : adaptee(new BaseChannelChatStateInterface::Adaptee(parent))
+ {
+ }
+
+ Tp::ChatStateMap chatStates;
+ SetChatStateCallback setChatStateCB;
+ BaseChannelChatStateInterface::Adaptee *adaptee;
+};
+
+BaseChannelChatStateInterface::Adaptee::Adaptee(BaseChannelChatStateInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelChatStateInterface::Adaptee::~Adaptee()
+{
+}
+
+Tp::ChatStateMap BaseChannelChatStateInterface::Adaptee::chatStates() const
+{
+ return mInterface->chatStates();
+}
+
+void BaseChannelChatStateInterface::Adaptee::setChatState(uint state,
+ const Tp::Service::ChannelInterfaceChatStateAdaptor::SetChatStateContextPtr &context)
+{
+ debug() << "BaseChannelChatStateInterface::Adaptee::setChatState";
+ DBusError error;
+ mInterface->setChatState(state, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+/**
+ * \class BaseChannelChatStateInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Interface.Chat.State
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelChatStateInterface::BaseChannelChatStateInterface()
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_CHAT_STATE),
+ mPriv(new Private(this))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelChatStateInterface::~BaseChannelChatStateInterface()
+{
+ delete mPriv;
+}
+
+Tp::ChatStateMap BaseChannelChatStateInterface::chatStates() const
+{
+ return mPriv->chatStates;
+}
+
+void BaseChannelChatStateInterface::setChatStates(const Tp::ChatStateMap &chatStates)
+{
+ mPriv->chatStates = chatStates;
+}
+
+void BaseChannelChatStateInterface::createAdaptor()
+{
+ (void) new Service::ChannelInterfaceChatStateAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+void BaseChannelChatStateInterface::setSetChatStateCallback(const BaseChannelChatStateInterface::SetChatStateCallback &cb)
+{
+ mPriv->setChatStateCB = cb;
+}
+
+void BaseChannelChatStateInterface::setChatState(uint state, DBusError *error)
+{
+ if (!mPriv->setChatStateCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->setChatStateCB(state, error);
+}
+
+void BaseChannelChatStateInterface::chatStateChanged(uint contact, uint state)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "chatStateChanged", Q_ARG(uint, contact), Q_ARG(uint, state)); //Can simply use emit in Qt5
+}
+
+// Chan.I.Group
+// The BaseChannelGroupInterface code is fully or partially generated by the TelepathyQt-Generator.
struct TP_QT_NO_EXPORT BaseChannelGroupInterface::Private {
- Private(BaseChannelGroupInterface *parent, ChannelGroupFlags initialFlags, uint selfHandle)
- : flags(initialFlags),
- selfHandle(selfHandle),
- adaptee(new BaseChannelGroupInterface::Adaptee(parent)) {
+ Private(BaseChannelGroupInterface *parent)
+ : connection(nullptr),
+ selfHandle(0),
+ adaptee(new BaseChannelGroupInterface::Adaptee(parent))
+ {
}
- ChannelGroupFlags flags;
+
+ Tp::UIntList getLocalPendingList() const;
+ bool updateMemberIdentifiers();
+ void emitMembersChangedSignal(const Tp::UIntList &added, const Tp::UIntList &removed, const Tp::UIntList &localPending, const Tp::UIntList &remotePending, QVariantMap details) const;
+
+ BaseConnection *connection;
+ Tp::ChannelGroupFlags groupFlags;
Tp::HandleOwnerMap handleOwners;
Tp::LocalPendingInfoList localPendingMembers;
Tp::UIntList members;
Tp::UIntList remotePendingMembers;
uint selfHandle;
Tp::HandleIdentifierMap memberIdentifiers;
- RemoveMembersCallback removeMembersCB;
AddMembersCallback addMembersCB;
- Tp::UIntList getLocalPendingMembers() const {
- Tp::UIntList ret;
- foreach(const LocalPendingInfo & info, localPendingMembers)
- ret << info.toBeAdded;
- return ret;
- }
+ RemoveMembersCallback removeMembersCB;
BaseChannelGroupInterface::Adaptee *adaptee;
};
+BaseChannelGroupInterface::Adaptee::Adaptee(BaseChannelGroupInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelGroupInterface::Adaptee::~Adaptee()
+{
+}
+
uint BaseChannelGroupInterface::Adaptee::groupFlags() const
{
- return mInterface->mPriv->flags;
+ return mInterface->groupFlags();
}
Tp::HandleOwnerMap BaseChannelGroupInterface::Adaptee::handleOwners() const
{
- return mInterface->mPriv->handleOwners;
+ return mInterface->handleOwners();
}
Tp::LocalPendingInfoList BaseChannelGroupInterface::Adaptee::localPendingMembers() const
{
- return mInterface->mPriv->localPendingMembers;
+ return mInterface->localPendingMembers();
}
Tp::UIntList BaseChannelGroupInterface::Adaptee::members() const
{
- return mInterface->mPriv->members;
+ return mInterface->members();
}
Tp::UIntList BaseChannelGroupInterface::Adaptee::remotePendingMembers() const
{
- return mInterface->mPriv->remotePendingMembers;
+ return mInterface->remotePendingMembers();
}
uint BaseChannelGroupInterface::Adaptee::selfHandle() const
{
- return mInterface->mPriv->selfHandle;
+ return mInterface->selfHandle();
}
Tp::HandleIdentifierMap BaseChannelGroupInterface::Adaptee::memberIdentifiers() const
{
- return mInterface->mPriv->memberIdentifiers;
+ return mInterface->memberIdentifiers();
}
-void BaseChannelGroupInterface::Adaptee::addMembers(const Tp::UIntList& contacts,
- const QString& message,
+void BaseChannelGroupInterface::Adaptee::addMembers(const Tp::UIntList &contacts, const QString &message,
const Tp::Service::ChannelInterfaceGroupAdaptor::AddMembersContextPtr &context)
{
- debug() << "BaseChannelGroupInterface::Adaptee::addMembers";
- if (!mInterface->mPriv->addMembersCB.isValid()) {
+ qDebug() << "BaseChannelGroupInterface::Adaptee::addMembers";
+ DBusError error;
+ mInterface->addMembers(contacts, message, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseChannelGroupInterface::Adaptee::removeMembers(const Tp::UIntList &contacts, const QString &message,
+ const Tp::Service::ChannelInterfaceGroupAdaptor::RemoveMembersContextPtr &context)
+{
+ qDebug() << "BaseChannelGroupInterface::Adaptee::removeMembers";
+ DBusError error;
+ mInterface->removeMembers(contacts, message, Tp::ChannelGroupChangeReasonNone, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseChannelGroupInterface::Adaptee::removeMembersWithReason(const Tp::UIntList &contacts, const QString &message, uint reason,
+ const Tp::Service::ChannelInterfaceGroupAdaptor::RemoveMembersWithReasonContextPtr &context)
+{
+ qDebug() << "BaseChannelGroupInterface::Adaptee::removeMembersWithReason";
+ DBusError error;
+ mInterface->removeMembers(contacts, message, reason, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+UIntList BaseChannelGroupInterface::Private::getLocalPendingList() const
+{
+ Tp::UIntList localPending;
+
+ foreach (const Tp::LocalPendingInfo &info, localPendingMembers) {
+ localPending << info.toBeAdded;
+ }
+
+ return localPending;
+}
+
+bool BaseChannelGroupInterface::Private::updateMemberIdentifiers()
+{
+ Tp::UIntList handles = members + remotePendingMembers + handleOwners.values();
+ handles << selfHandle;
+
+ foreach (const Tp::LocalPendingInfo &info, localPendingMembers) {
+ handles << info.toBeAdded;
+ if (info.actor && !handles.contains(info.actor)) {
+ handles << info.actor;
+ }
+ }
+
+ Tp::DBusError error;
+ const QStringList identifiers = connection->inspectHandles(Tp::HandleTypeContact, handles, &error);
+
+ if (error.isValid() || (handles.count() != identifiers.count())) {
+ return false;
+ }
+
+ memberIdentifiers.clear();
+
+ for (int i = 0; i < identifiers.count(); ++i) {
+ memberIdentifiers[handles.at(i)] = identifiers.at(i);
+ }
+ return true;
+}
+
+void BaseChannelGroupInterface::Private::emitMembersChangedSignal(const UIntList &added, const UIntList &removed, const UIntList &localPending, const UIntList &remotePending, QVariantMap details) const
+{
+ const uint actor = details.value(QLatin1String("actor"), 0).toUInt();
+ const uint reason = details.value(QLatin1String("change-reason"), Tp::ChannelGroupChangeReasonNone).toUInt();
+ const QString message = details.value(QLatin1String("message")).toString();
+
+ QMetaObject::invokeMethod(adaptee, "membersChanged",
+ Q_ARG(QString, message),
+ Q_ARG(Tp::UIntList, added),
+ Q_ARG(Tp::UIntList, removed),
+ Q_ARG(Tp::UIntList, localPending),
+ Q_ARG(Tp::UIntList, remotePending),
+ Q_ARG(uint, actor), Q_ARG(uint, reason)); //Can simply use emit in Qt5
+
+ if (!details.contains(QLatin1String("contact-ids"))) {
+ HandleIdentifierMap contactIds;
+ foreach (uint handle, added + localPending + remotePending) {
+ contactIds[handle] = memberIdentifiers[handle];
+ }
+ details.insert(QLatin1String("contact-ids"), QVariant::fromValue(contactIds));
+ }
+
+ QMetaObject::invokeMethod(adaptee, "membersChangedDetailed",
+ Q_ARG(Tp::UIntList, added),
+ Q_ARG(Tp::UIntList, removed),
+ Q_ARG(Tp::UIntList, localPending),
+ Q_ARG(Tp::UIntList, remotePending),
+ Q_ARG(QVariantMap, details));
+}
+
+/**
+ * \class BaseChannelGroupInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Interface.Group.
+ *
+ * Interface for channels which have multiple members, and where the members of the channel can
+ * change during its lifetime. Your presence in the channel cannot be presumed by the channel's
+ * existence (for example, a channel you may request membership of but your request may not be
+ * granted).
+ *
+ * This interface implements three lists: a list of current members, and two lists of local
+ * pending and remote pending members. Contacts on the remote pending list have been invited to
+ * the channel, but the remote user has not accepted the invitation. Contacts on the local pending
+ * list have requested membership of the channel, but the local user of the framework must accept
+ * their request before they may join. A single contact should never appear on more than one of
+ * the three lists. The lists are empty when the channel is created, and the MembersChanged signal
+ * (and, if the channel's GroupFlags contains Tp::ChannelGroupFlagMembersChangedDetailed, the
+ * MembersChangedDetailed signal) should be emitted when information is retrieved from the server,
+ * or changes occur.
+ *
+ * Addition of members to the channel may be requested by using AddMembers. If remote
+ * acknowledgement is required, use of the AddMembers method will cause users to appear on the
+ * remote pending list. If no acknowledgement is required, AddMembers will add contacts to the
+ * member list directly. If a contact is awaiting authorisation on the local pending list,
+ * AddMembers will grant their membership request.
+ *
+ * Removal of contacts from the channel may be requested by using RemoveMembers. If a contact is
+ * awaiting authorisation on the local pending list, RemoveMembers will refuse their membership
+ * request. If a contact is on the remote pending list but has not yet accepted the invitation,
+ * RemoveMembers will rescind the request if possible.
+ *
+ * It should not be presumed that the requester of a channel implementing this interface is
+ * immediately granted membership, or indeed that they are a member at all, unless they appear
+ * in the list. They may, for instance, be placed into the remote pending list until a connection
+ * has been established or the request acknowledged remotely.
+ *
+ * If the local user joins a Group channel whose members or other state cannot be discovered until
+ * the user joins (e.g. many chat room implementations), the connection manager should ensure that
+ * the channel is, as far as possible, in a consistent state before adding the local contact to the
+ * members set; until this happens, the local contact should be in the remote-pending set. For
+ * instance, if the connection manager queries the server to find out the initial members list for
+ * the channel, it should leave the local contact in the remote-pending set until it has finished
+ * receiving the initial members list.
+ *
+ * If the protocol provides no reliable way to tell whether the complete initial members list has
+ * been received yet, the connection manager should make a best-effort attempt to wait for the full
+ * list (in the worst case, waiting for a suitable arbitrary timeout) rather than requiring user
+ * interfaces to do so on its behalf.
+ *
+ * Minimal implementation of the interface should setup group flags (setGroupFlags()) and have
+ * a setMembers() call. If the selfHandle is present in the group, then the setSelfHandle() should
+ * be used to correctly setup the interface. Regardless of the group flags, the connection manager
+ * implementation should setup removeMembers callback in order to let client leave the group
+ * gracefully. If doing so fails with Tp::ChannelGroupChangeReasonPermissionDenied, this is
+ * considered to a bug in the connection manager, but clients MUST recover by falling back to
+ * closing the channel with the Close method.
+ *
+ * Depending on the protocol capabilities, addMembers() and removeMembers() callbacks can be setup
+ * to support group members addition, invitation and removal.
+ *
+ * Note, that the interface automatically update the MemberIdentifiers property on members changes.
+ *
+ * \sa setGroupFlags(), setSelfHandle(), setMembers(), setAddMembersCallback(),
+ * setRemoveMembersCallback(), setHandleOwners(),
+ * setLocalPendingMembers(), setRemotePendingMembers()
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelGroupInterface::BaseChannelGroupInterface()
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_GROUP),
+ mPriv(new Private(this))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelGroupInterface::~BaseChannelGroupInterface()
+{
+ delete mPriv;
+}
+
+void BaseChannelGroupInterface::setBaseChannel(BaseChannel *channel)
+{
+ mPriv->connection = channel->connection();
+}
+
+/**
+ * Return the flags on this channel.
+ *
+ * The user interface can use this property to present information about which operations
+ * are currently valid.
+ *
+ * \return An the flags on this channel.
+ *
+ * \sa setGroupFlags()
+ * \sa Tp::ChannelGroupFlag
+ */
+Tp::ChannelGroupFlags BaseChannelGroupInterface::groupFlags() const
+{
+ return mPriv->groupFlags | Tp::ChannelGroupFlagProperties | Tp::ChannelGroupFlagMembersChangedDetailed;
+}
+
+/**
+ * Set the group flags for this channel.
+ *
+ * The user interface can use this to present information about which operations are currently valid.
+ * Take a note, that Tp::ChannelGroupFlagProperties and Tp::ChannelGroupFlagMembersChangedDetailed flags setted up
+ * unconditionally. This way we always provide modern properties (ChannelGroupFlagProperties) and automatically
+ * emit signal MembersChangedDetailed. There is no reason to behave differently and this improve compatibility with
+ * future Telepathy specs.
+ *
+ * \param flags The flags on this channel.
+ *
+ * \sa groupFlags()
+ * \sa Tp::ChannelGroupFlag
+ */
+void BaseChannelGroupInterface::setGroupFlags(const Tp::ChannelGroupFlags &flags)
+{
+ const Tp::ChannelGroupFlags keptFlags = mPriv->groupFlags & flags;
+ const Tp::ChannelGroupFlags added = flags & ~keptFlags;
+ const Tp::ChannelGroupFlags removed = mPriv->groupFlags & ~keptFlags;
+
+ mPriv->groupFlags = flags;
+ QMetaObject::invokeMethod(mPriv->adaptee, "groupFlagsChanged", Q_ARG(uint, added), Q_ARG(uint, removed)); //Can simply use emit in Qt5
+}
+
+/**
+ * Return a list of this channel members.
+ *
+ * The members of this channel.
+ *
+ * \return A list of this channel members.
+ */
+Tp::UIntList BaseChannelGroupInterface::members() const
+{
+ return mPriv->members;
+}
+
+/**
+ * Set the list of current members of the channel.
+ *
+ * Set the list of current members. Added members would be automatically removed from the local
+ * and remote pending lists.
+ *
+ * \param members The actual list of members of the channel.
+ * \param details The map with an information about the change.
+ *
+ * \sa members()
+ * \sa setMembers(const UIntList &, const Tp::LocalPendingInfoList &, const Tp::UIntList &, const QVariantMap &)
+ * \sa localPendingMembers()
+ * \sa remotePendingMembers()
+ */
+void BaseChannelGroupInterface::setMembers(const UIntList &members, const QVariantMap &details)
+{
+ Tp::UIntList localPendingList = mPriv->getLocalPendingList();
+
+ Tp::UIntList added;
+ foreach (uint handle, members) {
+ if (!mPriv->members.contains(handle)) {
+ added << handle;
+
+ // Remove added member from the local pending list
+ int indexInLocalPending = localPendingList.indexOf(handle);
+
+ if (indexInLocalPending >= 0) {
+ localPendingList.removeAt(indexInLocalPending);
+ mPriv->localPendingMembers.removeAt(indexInLocalPending);
+ }
+
+ // Remove added member from the remote pending list
+ int indexInRemotePending = mPriv->remotePendingMembers.indexOf(handle);
+
+ if (indexInRemotePending >= 0) {
+ mPriv->remotePendingMembers.removeAt(indexInRemotePending);
+ }
+ }
+ }
+
+ Tp::UIntList removed;
+ foreach (uint handle, mPriv->members) {
+ if (!members.contains(handle)) {
+ removed << handle;
+ }
+ }
+
+ mPriv->members = members;
+
+ mPriv->updateMemberIdentifiers();
+ mPriv->emitMembersChangedSignal(added, removed, localPendingList, mPriv->remotePendingMembers, details);
+}
+
+/**
+ * Set the list of members of the channel.
+ *
+ * Set the list of current members and update local and remote pending lists at the same time.
+ *
+ * \param members The actual list of members of the channel.
+ * \param localPending The actual list of local pending members of the channel.
+ * \param remotePending The actual list of remote pending members of the channel.
+ * \param details The map with an information about the change.
+ *
+ * \sa members()
+ * \sa setMembers(const UIntList &, const QVariantMap &)
+ * \sa localPendingMembers()
+ * \sa remotePendingMembers()
+ */
+void BaseChannelGroupInterface::setMembers(const Tp::UIntList &members, const Tp::LocalPendingInfoList &localPending, const Tp::UIntList &remotePending, const QVariantMap &details)
+{
+ Tp::UIntList added;
+ foreach (uint handle, members) {
+ if (!mPriv->members.contains(handle)) {
+ added << handle;
+ }
+ }
+
+ Tp::UIntList removed;
+ foreach (uint handle, mPriv->members) {
+ if (!members.contains(handle)) {
+ removed << handle;
+ }
+ }
+
+ // Do not use the setters here to avoid signal duplication
+ mPriv->localPendingMembers = localPending;
+ mPriv->remotePendingMembers = remotePending;
+ mPriv->members = members;
+
+ mPriv->updateMemberIdentifiers();
+ mPriv->emitMembersChangedSignal(added, removed, mPriv->getLocalPendingList(), remotePending, details);
+}
+
+/**
+ * Return a map from channel-specific handles to their owners.
+ *
+ * An integer representing the bitwise-OR of flags on this channel. The user interface
+ * can use this property to present information about which operations are currently valid.
+ *
+ * \return A map from channel-specific handles to their owners.
+ */
+Tp::HandleOwnerMap BaseChannelGroupInterface::handleOwners() const
+{
+ return mPriv->handleOwners;
+}
+
+/**
+ * Set a map from channel-specific handles to their owners.
+ *
+ * A map from channel-specific handles to their owners, including at least all of the
+ * channel-specific handles in this channel's members, local-pending or remote-pending
+ * sets as keys. Any handle not in the keys of this mapping is not channel-specific in
+ * this channel. Handles which are channel-specific, but for which the owner is unknown,
+ * MUST appear in this mapping with 0 as owner.
+ *
+ * \param handleOwners The new (actual) handle owners map.
+ *
+ * \sa handleOwners(), members(), localPendingMembers(), remotePendingMembers()
+ */
+void BaseChannelGroupInterface::setHandleOwners(const Tp::HandleOwnerMap &handleOwners)
+{
+ Tp::HandleOwnerMap added;
+ Tp::UIntList removed;
+
+ foreach (uint ownerHandle, mPriv->handleOwners.keys()) {
+ if (!handleOwners.contains(ownerHandle)) {
+ removed << ownerHandle;
+ }
+ }
+
+ foreach (uint ownerHandle, handleOwners.keys()) {
+ if (!mPriv->handleOwners.contains(ownerHandle)) {
+ added[ownerHandle] = handleOwners.value(ownerHandle);
+ }
+ }
+
+ mPriv->handleOwners = handleOwners;
+ mPriv->updateMemberIdentifiers();
+
+ Tp::HandleIdentifierMap identifiers;
+
+ foreach (uint ownerHandle, added) {
+ identifiers[ownerHandle] = mPriv->memberIdentifiers.value(ownerHandle);
+ }
+
+ QMetaObject::invokeMethod(mPriv->adaptee, "handleOwnersChanged", Q_ARG(Tp::HandleOwnerMap, added), Q_ARG(Tp::UIntList, removed)); //Can simply use emit in Qt5
+ QMetaObject::invokeMethod(mPriv->adaptee, "handleOwnersChangedDetailed", Q_ARG(Tp::HandleOwnerMap, added), Q_ARG(Tp::UIntList, removed), Q_ARG(Tp::HandleIdentifierMap, identifiers)); //Can simply use emit in Qt5
+}
+
+/**
+ * Return an array of contacts requesting channel membership
+ *
+ * An array of structs containing handles representing contacts requesting channel
+ * membership and awaiting local approval with AddMembers call.
+ *
+ * \return An array of contacts requesting channel membership
+ */
+Tp::LocalPendingInfoList BaseChannelGroupInterface::localPendingMembers() const
+{
+ return mPriv->localPendingMembers;
+}
+
+/**
+ * Set local pending members information list.
+ *
+ * This method is recommended to use for the local pending members list changes.
+ * If the change affect the list and members list, use setMembers() instead.
+ *
+ * \param localPendingMembers
+ *
+ * \sa localPendingMembers(), setRemotePendingMembers(), setMembers()
+ */
+void BaseChannelGroupInterface::setLocalPendingMembers(const Tp::LocalPendingInfoList &localPendingMembers)
+{
+ mPriv->localPendingMembers = localPendingMembers;
+ mPriv->updateMemberIdentifiers();
+
+ uint actor = 0;
+ uint reason = Tp::ChannelGroupChangeReasonNone;
+ QString message;
+ Tp::UIntList localPending;
+
+ Tp::HandleIdentifierMap contactIds;
+
+ if (!localPendingMembers.isEmpty()) {
+ actor = localPendingMembers.first().actor;
+ reason = localPendingMembers.first().reason;
+ message = localPendingMembers.first().message;
+
+ foreach (const Tp::LocalPendingInfo &info, localPendingMembers) {
+ localPending << info.toBeAdded;
+
+ if (actor != info.actor) {
+ actor = 0;
+ }
+
+ if (reason != info.reason) {
+ reason = 0;
+ }
+
+ if (message != info.message) {
+ message.clear();
+ }
+
+ contactIds[info.toBeAdded] = mPriv->memberIdentifiers.value(info.toBeAdded);
+ }
+ }
+
+ QVariantMap details;
+ details.insert(QLatin1String("actor"), QVariant::fromValue(actor));
+ details.insert(QLatin1String("change-reason"), QVariant::fromValue((uint)reason));
+ details.insert(QLatin1String("contact-ids"), QVariant::fromValue(contactIds));
+ details.insert(QLatin1String("message"), QVariant::fromValue(message));
+
+ mPriv->emitMembersChangedSignal(/* addedMembers */ Tp::UIntList(), /* removedMembers */ Tp::UIntList(), localPending, mPriv->remotePendingMembers, details);
+}
+
+/**
+ * Return an array of contacts requesting channel membership
+ *
+ * An array of handles representing contacts who have been invited
+ * to the channel and are awaiting remote approval.
+ *
+ * \return An array of contacts requesting channel membership
+ *
+ * \sa setRemotePendingMembers()
+ */
+Tp::UIntList BaseChannelGroupInterface::remotePendingMembers() const
+{
+ return mPriv->remotePendingMembers;
+}
+
+/**
+ * Set an array of contacts requesting channel membership
+ *
+ * An array of handles representing contacts who have been invited
+ * to the channel and are awaiting remote approval.
+ *
+ * This method is recommended to use for the remote pending members list changes.
+ * If the change affect the list and members list, use setMembers() instead.
+ *
+ * \param remotePendingMembers An array of contacts requesting channel membership
+ *
+ * \sa remotePendingMembers(), setLocalPendingMembers(), setMembers()
+ */
+void BaseChannelGroupInterface::setRemotePendingMembers(const Tp::UIntList &remotePendingMembers)
+{
+ mPriv->remotePendingMembers = remotePendingMembers;
+
+ mPriv->updateMemberIdentifiers();
+ mPriv->emitMembersChangedSignal(/* addedMembers */ Tp::UIntList(), /* removedMembers */ Tp::UIntList(), mPriv->getLocalPendingList(), mPriv->remotePendingMembers, /* details */ QVariantMap());
+}
+
+/**
+ * Return the handle of the user on this channel.
+ *
+ * See setSelfHandle() for details.
+ *
+ * \return The handle of the user on this channel.
+ */
+uint BaseChannelGroupInterface::selfHandle() const
+{
+ return mPriv->selfHandle;
+}
+
+/**
+ * Set the handle for the user on this channel.
+ *
+ * Set the handle for the user on this channel (which can also be a local or remote pending member),
+ * or 0 if the user is not a member at all (which is likely to be the case, for instance, on
+ * ContactList channels). Note that this is different from the result of Tp::Connection::selfHandle()
+ * on some protocols, so the value of this handle should always be used with the methods of this interface.
+ *
+ * \sa selfHandle()
+ */
+void BaseChannelGroupInterface::setSelfHandle(uint selfHandle)
+{
+ mPriv->selfHandle = selfHandle;
+
+ // selfHandleChanged is deprecated since 0.23.4.
+ QMetaObject::invokeMethod(mPriv->adaptee, "selfHandleChanged", Q_ARG(uint, selfHandle)); //Can simply use emit in Qt5
+
+ if (mPriv->connection) {
+ DBusError error;
+ QStringList selfID = mPriv->connection->inspectHandles(Tp::HandleTypeContact, Tp::UIntList() << selfHandle, &error);
+
+ if (!selfID.isEmpty()) {
+ QMetaObject::invokeMethod(mPriv->adaptee, "selfContactChanged", Q_ARG(uint, selfHandle), Q_ARG(QString, selfID.first())); //Can simply use emit in Qt5
+ }
+ }
+}
+
+/**
+ * Return the string identifiers for handles mentioned in this channel.
+ *
+ * The string identifiers for handles mentioned in this channel, to give clients
+ * the minimal information necessary to create contacts without waiting for round-trips.
+ *
+ * The property provided by the interface itself and based on selfHandle(), members(),
+ * localPendingMembers(), remotePendingMembers() and handleOwners() values.
+ *
+ * \return The string identifiers for handles mentioned in this channel.
+ */
+Tp::HandleIdentifierMap BaseChannelGroupInterface::memberIdentifiers() const
+{
+ return mPriv->memberIdentifiers;
+}
+
+void BaseChannelGroupInterface::createAdaptor()
+{
+ (void) new Tp::Service::ChannelInterfaceGroupAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+/**
+ * Set a callback that will be called to add members to the group.
+ *
+ * Invite all the given contacts into the channel, or accept requests for channel membership
+ * for contacts on the pending local list.
+ *
+ * A message may be provided along with the request, which will be sent to the server if supported.
+ * See the Tp::ChannelGroupFlag to find out in which cases the message should be provided.
+ *
+ * Attempting to add contacts who are already members is allowed; connection managers must silently
+ * accept this, without error.
+ *
+ * \param cb The callback to set.
+ * \sa addMembers()
+ * \sa setRemoveMembersCallback()
+ */
+void BaseChannelGroupInterface::setAddMembersCallback(const AddMembersCallback &cb)
+{
+ mPriv->addMembersCB = cb;
+}
+
+/**
+ * Call the AddMembers callback with passed arguments.
+ *
+ * \param contacts An array of contact handles to invite to the channel.
+ * \param message A string message, which can be blank if desired.
+ * \param error A pointer to Tp::DBusError object for error information.
+ *
+ * \sa setAddMembersCallback()
+ */
+void BaseChannelGroupInterface::addMembers(const Tp::UIntList &contacts, const QString &message, DBusError *error)
+{
+ if (!mPriv->addMembersCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->addMembersCB(contacts, message, error);
+}
+
+/**
+ * Set a callback that will be called to remove members from the group with a reason.
+ *
+ * %Connection manager should setup this callback to support requests for: the removal contacts from
+ * the channel, reject their request for channel membership on the pending local list, or rescind
+ * their invitation on the pending remote list.
+ *
+ * If the SelfHandle is in the group, it can be removed via this method, in order to leave the
+ * group gracefully. This is the recommended way to leave a chatroom, close or reject a call, and
+ * so on.
+ *
+ * Accordingly, connection managers SHOULD support doing this, regardless of the value of
+ * GroupFlags. If doing so fails with PermissionDenied, this is considered to a bug in the
+ * connection manager, but clients MUST recover by falling back to closing the channel with the
+ * Close method.
+ *
+ * Removing any contact from the local pending list is always allowed. Removing contacts other than
+ * the SelfHandle from the channel's members is allowed if and only if Tp::ChannelGroupFlagCanRemove
+ * is in the groupFlags(), while removing contacts other than the SelfHandle from the remote pending
+ * list is allowed if and only if Tp::ChannelGroupFlagCanRescind is in the groupFlags().
+ *
+ * A message may be provided along with the request, which will be sent to the server if supported.
+ * See the Tp::ChannelGroupFlag to find out in which cases the message should be provided.
+ *
+ * The reason code may be ignored if the underlying protocol is unable to represent the given reason.
+ *
+ * \param cb The callback to set.
+ *
+ * \sa removeMembers()
+ * \sa setRemoveMembersCallback()
+ */
+void BaseChannelGroupInterface::setRemoveMembersCallback(const RemoveMembersCallback &cb)
+{
+ mPriv->removeMembersCB = cb;
+}
+
+/**
+ * Call the RemoveMembers callback with passed arguments.
+ *
+ * \param contacts An array of contact handles to remove from the channel.
+ * \param message A string message, which can be blank if desired.
+ * \param reason A reason for the change.
+ * \param error A pointer to Tp::DBusError object for error information.
+ *
+ * \sa setRemoveMembersCallback()
+ */
+void BaseChannelGroupInterface::removeMembers(const Tp::UIntList &contacts, const QString &message, uint reason, DBusError *error)
+{
+ if (!mPriv->removeMembersCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->removeMembersCB(contacts, message, reason, error);
+}
+
+// Chan.I.Room2
+// The BaseChannelRoomInterface code is fully or partially generated by the TelepathyQt-Generator.
+struct TP_QT_NO_EXPORT BaseChannelRoomInterface::Private {
+ Private(BaseChannelRoomInterface *parent,
+ const QString &roomName,
+ const QString &server,
+ const QString &creator,
+ uint creatorHandle,
+ const QDateTime &creationTimestamp)
+ : roomName(roomName),
+ server(server),
+ creator(creator),
+ creatorHandle(creatorHandle),
+ creationTimestamp(creationTimestamp),
+ adaptee(new BaseChannelRoomInterface::Adaptee(parent))
+ {
+ }
+
+ QString roomName;
+ QString server;
+ QString creator;
+ uint creatorHandle;
+ QDateTime creationTimestamp;
+ BaseChannelRoomInterface::Adaptee *adaptee;
+};
+
+BaseChannelRoomInterface::Adaptee::Adaptee(BaseChannelRoomInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelRoomInterface::Adaptee::~Adaptee()
+{
+}
+
+QString BaseChannelRoomInterface::Adaptee::roomName() const
+{
+ return mInterface->roomName();
+}
+
+QString BaseChannelRoomInterface::Adaptee::server() const
+{
+ return mInterface->server();
+}
+
+QString BaseChannelRoomInterface::Adaptee::creator() const
+{
+ return mInterface->creator();
+}
+
+uint BaseChannelRoomInterface::Adaptee::creatorHandle() const
+{
+ return mInterface->creatorHandle();
+}
+
+qlonglong BaseChannelRoomInterface::Adaptee::creationTimestamp() const
+{
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
+ return mInterface->creationTimestamp().toTime_t();
+#else
+ return mInterface->creationTimestamp().toSecsSinceEpoch();
+#endif
+}
+
+/**
+ * \class BaseChannelRoomInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Interface.Room2
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelRoomInterface::BaseChannelRoomInterface(const QString &roomName,
+ const QString &server,
+ const QString &creator,
+ uint creatorHandle,
+ const QDateTime &creationTimestamp)
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_ROOM),
+ mPriv(new Private(this, roomName, server, creator, creatorHandle, creationTimestamp))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelRoomInterface::~BaseChannelRoomInterface()
+{
+ delete mPriv;
+}
+
+/**
+ * Return the immutable properties of this interface.
+ *
+ * Immutable properties cannot change after the interface has been registered
+ * on a service on the bus with registerInterface().
+ *
+ * \return The immutable properties of this interface.
+ */
+QVariantMap BaseChannelRoomInterface::immutableProperties() const
+{
+ QVariantMap map;
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_ROOM + QLatin1String(".RoomName"),
+ QVariant::fromValue(mPriv->adaptee->roomName()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_ROOM + QLatin1String(".Server"),
+ QVariant::fromValue(mPriv->adaptee->server()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_ROOM + QLatin1String(".Creator"),
+ QVariant::fromValue(mPriv->adaptee->creator()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_ROOM + QLatin1String(".CreatorHandle"),
+ QVariant::fromValue(mPriv->adaptee->creatorHandle()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_ROOM + QLatin1String(".CreationTimestamp"),
+ QVariant::fromValue(mPriv->adaptee->creationTimestamp()));
+ return map;
+}
+
+QString BaseChannelRoomInterface::roomName() const
+{
+ return mPriv->roomName;
+}
+
+QString BaseChannelRoomInterface::server() const
+{
+ return mPriv->server;
+}
+
+QString BaseChannelRoomInterface::creator() const
+{
+ return mPriv->creator;
+}
+
+uint BaseChannelRoomInterface::creatorHandle() const
+{
+ return mPriv->creatorHandle;
+}
+
+QDateTime BaseChannelRoomInterface::creationTimestamp() const
+{
+ return mPriv->creationTimestamp;
+}
+
+void BaseChannelRoomInterface::createAdaptor()
+{
+ (void) new Service::ChannelInterfaceRoomAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+// Chan.I.RoomConfig1
+// The BaseChannelRoomConfigInterface code is fully or partially generated by the TelepathyQt-Generator.
+struct TP_QT_NO_EXPORT BaseChannelRoomConfigInterface::Private {
+ Private(BaseChannelRoomConfigInterface *parent)
+ : anonymous(false),
+ inviteOnly(false),
+ limit(0),
+ moderated(false),
+ persistent(false),
+ isPrivate(false),
+ passwordProtected(false),
+ canUpdateConfiguration(false),
+ configurationRetrieved(false),
+ adaptee(new BaseChannelRoomConfigInterface::Adaptee(parent))
+ {
+ }
+
+ bool anonymous;
+ bool inviteOnly;
+ uint limit;
+ bool moderated;
+ QString title;
+ QString description;
+ bool persistent;
+ bool isPrivate;
+ bool passwordProtected;
+ QString password;
+ QString passwordHint;
+ bool canUpdateConfiguration;
+ QStringList mutableProperties;
+ bool configurationRetrieved;
+ UpdateConfigurationCallback updateConfigurationCB;
+ BaseChannelRoomConfigInterface::Adaptee *adaptee;
+};
+
+BaseChannelRoomConfigInterface::Adaptee::Adaptee(BaseChannelRoomConfigInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelRoomConfigInterface::Adaptee::~Adaptee()
+{
+}
+
+bool BaseChannelRoomConfigInterface::Adaptee::anonymous() const
+{
+ return mInterface->anonymous();
+}
+
+bool BaseChannelRoomConfigInterface::Adaptee::inviteOnly() const
+{
+ return mInterface->inviteOnly();
+}
+
+uint BaseChannelRoomConfigInterface::Adaptee::limit() const
+{
+ return mInterface->limit();
+}
+
+bool BaseChannelRoomConfigInterface::Adaptee::moderated() const
+{
+ return mInterface->moderated();
+}
+
+QString BaseChannelRoomConfigInterface::Adaptee::title() const
+{
+ return mInterface->title();
+}
+
+QString BaseChannelRoomConfigInterface::Adaptee::description() const
+{
+ return mInterface->description();
+}
+
+bool BaseChannelRoomConfigInterface::Adaptee::persistent() const
+{
+ return mInterface->persistent();
+}
+
+bool BaseChannelRoomConfigInterface::Adaptee::isPrivate() const
+{
+ return mInterface->isPrivate();
+}
+
+bool BaseChannelRoomConfigInterface::Adaptee::passwordProtected() const
+{
+ return mInterface->passwordProtected();
+}
+
+QString BaseChannelRoomConfigInterface::Adaptee::password() const
+{
+ return mInterface->password();
+}
+
+QString BaseChannelRoomConfigInterface::Adaptee::passwordHint() const
+{
+ return mInterface->passwordHint();
+}
+
+bool BaseChannelRoomConfigInterface::Adaptee::canUpdateConfiguration() const
+{
+ return mInterface->canUpdateConfiguration();
+}
+
+QStringList BaseChannelRoomConfigInterface::Adaptee::mutableProperties() const
+{
+ return mInterface->mutableProperties();
+}
+
+bool BaseChannelRoomConfigInterface::Adaptee::configurationRetrieved() const
+{
+ return mInterface->configurationRetrieved();
+}
+
+void BaseChannelRoomConfigInterface::Adaptee::updateConfiguration(const QVariantMap &properties,
+ const Tp::Service::ChannelInterfaceRoomConfigAdaptor::UpdateConfigurationContextPtr &context)
+{
+ debug() << "BaseChannelRoomConfigInterface::Adaptee::updateConfiguration";
+ DBusError error;
+ mInterface->updateConfiguration(properties, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+/**
+ * \class BaseChannelRoomConfigInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Interface.RoomConfig1
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelRoomConfigInterface::BaseChannelRoomConfigInterface()
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_ROOM_CONFIG),
+ mPriv(new Private(this))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelRoomConfigInterface::~BaseChannelRoomConfigInterface()
+{
+ delete mPriv;
+}
+
+bool BaseChannelRoomConfigInterface::anonymous() const
+{
+ return mPriv->anonymous;
+}
+
+void BaseChannelRoomConfigInterface::setAnonymous(bool anonymous)
+{
+ mPriv->anonymous = anonymous;
+ notifyPropertyChanged(QLatin1String("Anonymous"), QVariant::fromValue(anonymous));
+}
+
+bool BaseChannelRoomConfigInterface::inviteOnly() const
+{
+ return mPriv->inviteOnly;
+}
+
+void BaseChannelRoomConfigInterface::setInviteOnly(bool inviteOnly)
+{
+ mPriv->inviteOnly = inviteOnly;
+ notifyPropertyChanged(QLatin1String("InviteOnly"), QVariant::fromValue(inviteOnly));
+}
+
+uint BaseChannelRoomConfigInterface::limit() const
+{
+ return mPriv->limit;
+}
+
+void BaseChannelRoomConfigInterface::setLimit(uint limit)
+{
+ mPriv->limit = limit;
+ notifyPropertyChanged(QLatin1String("Limit"), QVariant::fromValue(limit));
+}
+
+bool BaseChannelRoomConfigInterface::moderated() const
+{
+ return mPriv->moderated;
+}
+
+void BaseChannelRoomConfigInterface::setModerated(bool moderated)
+{
+ mPriv->moderated = moderated;
+ notifyPropertyChanged(QLatin1String("Moderated"), QVariant::fromValue(moderated));
+}
+
+QString BaseChannelRoomConfigInterface::title() const
+{
+ return mPriv->title;
+}
+
+void BaseChannelRoomConfigInterface::setTitle(const QString &title)
+{
+ mPriv->title = title;
+ notifyPropertyChanged(QLatin1String("Title"), QVariant::fromValue(title));
+}
+
+QString BaseChannelRoomConfigInterface::description() const
+{
+ return mPriv->description;
+}
+
+void BaseChannelRoomConfigInterface::setDescription(const QString &description)
+{
+ mPriv->description = description;
+ notifyPropertyChanged(QLatin1String("Description"), QVariant::fromValue(description));
+}
+
+bool BaseChannelRoomConfigInterface::persistent() const
+{
+ return mPriv->persistent;
+}
+
+void BaseChannelRoomConfigInterface::setPersistent(bool persistent)
+{
+ mPriv->persistent = persistent;
+ notifyPropertyChanged(QLatin1String("Persistent"), QVariant::fromValue(persistent));
+}
+
+bool BaseChannelRoomConfigInterface::isPrivate() const
+{
+ return mPriv->isPrivate;
+}
+
+void BaseChannelRoomConfigInterface::setPrivate(bool newPrivate)
+{
+ mPriv->isPrivate = newPrivate;
+ notifyPropertyChanged(QLatin1String("Private"), QVariant::fromValue(newPrivate));
+}
+
+bool BaseChannelRoomConfigInterface::passwordProtected() const
+{
+ return mPriv->passwordProtected;
+}
+
+void BaseChannelRoomConfigInterface::setPasswordProtected(bool passwordProtected)
+{
+ mPriv->passwordProtected = passwordProtected;
+ notifyPropertyChanged(QLatin1String("PasswordProtected"), QVariant::fromValue(passwordProtected));
+}
+
+QString BaseChannelRoomConfigInterface::password() const
+{
+ return mPriv->password;
+}
+
+void BaseChannelRoomConfigInterface::setPassword(const QString &password)
+{
+ mPriv->password = password;
+ notifyPropertyChanged(QLatin1String("Password"), QVariant::fromValue(password));
+}
+
+QString BaseChannelRoomConfigInterface::passwordHint() const
+{
+ return mPriv->passwordHint;
+}
+
+void BaseChannelRoomConfigInterface::setPasswordHint(const QString &passwordHint)
+{
+ mPriv->passwordHint = passwordHint;
+ notifyPropertyChanged(QLatin1String("PasswordHint"), QVariant::fromValue(passwordHint));
+}
+
+bool BaseChannelRoomConfigInterface::canUpdateConfiguration() const
+{
+ return mPriv->canUpdateConfiguration;
+}
+
+void BaseChannelRoomConfigInterface::setCanUpdateConfiguration(bool canUpdateConfiguration)
+{
+ mPriv->canUpdateConfiguration = canUpdateConfiguration;
+ notifyPropertyChanged(QLatin1String("CanUpdateConfiguration"), QVariant::fromValue(canUpdateConfiguration));
+}
+
+QStringList BaseChannelRoomConfigInterface::mutableProperties() const
+{
+ return mPriv->mutableProperties;
+}
+
+void BaseChannelRoomConfigInterface::setMutableProperties(const QStringList &mutableProperties)
+{
+ mPriv->mutableProperties = mutableProperties;
+ notifyPropertyChanged(QLatin1String("MutableProperties"), QVariant::fromValue(mutableProperties));
+}
+
+bool BaseChannelRoomConfigInterface::configurationRetrieved() const
+{
+ return mPriv->configurationRetrieved;
+}
+
+void BaseChannelRoomConfigInterface::setConfigurationRetrieved(bool configurationRetrieved)
+{
+ mPriv->configurationRetrieved = configurationRetrieved;
+ notifyPropertyChanged(QLatin1String("ConfigurationRetrieved"), QVariant::fromValue(configurationRetrieved));
+}
+
+void BaseChannelRoomConfigInterface::createAdaptor()
+{
+ (void) new Service::ChannelInterfaceRoomConfigAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+void BaseChannelRoomConfigInterface::setUpdateConfigurationCallback(const UpdateConfigurationCallback &cb)
+{
+ mPriv->updateConfigurationCB = cb;
+}
+
+void BaseChannelRoomConfigInterface::updateConfiguration(const QVariantMap &properties, DBusError *error)
+{
+ if (!mPriv->updateConfigurationCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->updateConfigurationCB(properties, error);
+}
+
+// Chan.T.Call
+BaseChannelCallType::Adaptee::Adaptee(BaseChannelCallType *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelCallType::Adaptee::~Adaptee()
+{
+}
+
+
+struct TP_QT_NO_EXPORT BaseChannelCallType::Private {
+ Private(BaseChannelCallType *parent, BaseChannel* channel, bool hardwareStreaming,
+ uint initialTransport,
+ bool initialAudio,
+ bool initialVideo,
+ QString initialAudioName,
+ QString initialVideoName,
+ bool mutableContents)
+ : hardwareStreaming(hardwareStreaming),
+ initialTransport(initialTransport),
+ initialAudio(initialAudio),
+ initialVideo(initialVideo),
+ initialAudioName(initialAudioName),
+ initialVideoName(initialVideoName),
+ mutableContents(mutableContents),
+ channel(channel),
+ adaptee(new BaseChannelCallType::Adaptee(parent)) {
+ }
+
+ Tp::ObjectPathList contents;
+ QVariantMap callStateDetails;
+ uint callState;
+ uint callFlags;
+ Tp::CallStateReason callStateReason;
+ bool hardwareStreaming;
+ Tp::CallMemberMap callMembers;
+ Tp::HandleIdentifierMap memberIdentifiers;
+ uint initialTransport;
+ bool initialAudio;
+ bool initialVideo;
+ QString initialAudioName;
+ QString initialVideoName;
+ bool mutableContents;
+
+ QList<Tp::BaseCallContentPtr> mCallContents;
+ AcceptCallback acceptCB;
+ HangupCallback hangupCB;
+ SetQueuedCallback setQueuedCB;
+ SetRingingCallback setRingingCB;
+ AddContentCallback addContentCB;
+
+ BaseChannel *channel;
+ BaseChannelCallType::Adaptee *adaptee;
+};
+
+void BaseChannelCallType::Adaptee::setRinging(const Tp::Service::ChannelTypeCallAdaptor::SetRingingContextPtr &context)
+{
+ if (!mInterface->mPriv->setRingingCB.isValid()) {
context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
return;
}
DBusError error;
- mInterface->mPriv->addMembersCB(contacts, message, &error);
+ mInterface->mPriv->setRingingCB(&error);
if (error.isValid()) {
context->setFinishedWithError(error.name(), error.message());
return;
@@ -1073,16 +3861,14 @@ void BaseChannelGroupInterface::Adaptee::addMembers(const Tp::UIntList& contacts
context->setFinished();
}
-void BaseChannelGroupInterface::Adaptee::removeMembers(const Tp::UIntList& contacts, const QString& message,
- const Tp::Service::ChannelInterfaceGroupAdaptor::RemoveMembersContextPtr &context)
+void BaseChannelCallType::Adaptee::setQueued(const Tp::Service::ChannelTypeCallAdaptor::SetQueuedContextPtr &context)
{
- debug() << "BaseChannelGroupInterface::Adaptee::removeMembers";
- if (!mInterface->mPriv->removeMembersCB.isValid()) {
+ if (!mInterface->mPriv->setQueuedCB.isValid()) {
context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
return;
}
DBusError error;
- mInterface->mPriv->removeMembersCB(contacts, message, &error);
+ mInterface->mPriv->setQueuedCB(&error);
if (error.isValid()) {
context->setFinishedWithError(error.name(), error.message());
return;
@@ -1090,80 +3876,604 @@ void BaseChannelGroupInterface::Adaptee::removeMembers(const Tp::UIntList& conta
context->setFinished();
}
-void BaseChannelGroupInterface::Adaptee::removeMembersWithReason(const Tp::UIntList& contacts,
- const QString& message,
- uint reason,
- const Tp::Service::ChannelInterfaceGroupAdaptor::RemoveMembersWithReasonContextPtr &context)
+void BaseChannelCallType::Adaptee::accept(const Tp::Service::ChannelTypeCallAdaptor::AcceptContextPtr &context)
+{
+ if (!mInterface->mPriv->acceptCB.isValid()) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ DBusError error;
+ mInterface->mPriv->acceptCB(&error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseChannelCallType::Adaptee::hangup(uint reason, const QString &detailedHangupReason, const QString &message, const Tp::Service::ChannelTypeCallAdaptor::HangupContextPtr &context)
+{
+ if (!mInterface->mPriv->hangupCB.isValid()) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ DBusError error;
+ mInterface->mPriv->hangupCB(reason, detailedHangupReason, message, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseChannelCallType::Adaptee::addContent(const QString &contentName, const Tp::MediaStreamType &contentType, const Tp::MediaStreamDirection &initialDirection, const Tp::Service::ChannelTypeCallAdaptor::AddContentContextPtr &context)
+{
+ if (!mInterface->mPriv->addContentCB.isValid()) {
+ Tp::BaseCallContentPtr ptr = mInterface->addContent(contentName, contentType, initialDirection);
+ QDBusObjectPath objPath;
+ objPath.setPath(ptr->objectPath());
+ context->setFinished(objPath);
+ return;
+ }
+
+ DBusError error;
+ QDBusObjectPath objPath = mInterface->mPriv->addContentCB(contentName, contentType, initialDirection, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(objPath);
+}
+
+/**
+ * \class BaseChannelCallType
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Type.Call
+ *
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelCallType::BaseChannelCallType(BaseChannel* channel, bool hardwareStreaming,
+ uint initialTransport,
+ bool initialAudio,
+ bool initialVideo,
+ QString initialAudioName,
+ QString initialVideoName,
+ bool mutableContents)
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_TYPE_CALL),
+ mPriv(new Private(this, channel,
+ hardwareStreaming,
+ initialTransport,
+ initialAudio,
+ initialVideo,
+ initialAudioName,
+ initialVideoName,
+ mutableContents))
+{
+}
+
+Tp::ObjectPathList BaseChannelCallType::contents() {
+ return mPriv->contents;
+}
+
+QVariantMap BaseChannelCallType::callStateDetails() {
+ return mPriv->callStateDetails;
+}
+
+uint BaseChannelCallType::callState() {
+ return mPriv->callState;
+}
+
+uint BaseChannelCallType::callFlags() {
+ return mPriv->callFlags;
+}
+
+Tp::CallStateReason BaseChannelCallType::callStateReason() {
+ return mPriv->callStateReason;
+}
+
+bool BaseChannelCallType::hardwareStreaming() {
+ return mPriv->hardwareStreaming;
+}
+
+Tp::CallMemberMap BaseChannelCallType::callMembers() {
+ return mPriv->callMembers;
+}
+
+Tp::HandleIdentifierMap BaseChannelCallType::memberIdentifiers() {
+ return mPriv->memberIdentifiers;
+}
+
+uint BaseChannelCallType::initialTransport() {
+ return mPriv->initialTransport;
+}
+
+bool BaseChannelCallType::initialAudio() {
+ return mPriv->initialAudio;
+}
+
+bool BaseChannelCallType::initialVideo() {
+ return mPriv->initialVideo;
+}
+
+QString BaseChannelCallType::initialVideoName() {
+ return mPriv->initialVideoName;
+}
+
+QString BaseChannelCallType::initialAudioName() {
+ return mPriv->initialAudioName;
+}
+
+bool BaseChannelCallType::mutableContents() {
+ return mPriv->mutableContents;
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelCallType::~BaseChannelCallType()
+{
+ delete mPriv;
+}
+
+QVariantMap BaseChannelCallType::immutableProperties() const
{
- debug() << "BaseChannelGroupInterface::Adaptee::removeMembersWithReason";
- removeMembers(contacts, message, context);
+ QVariantMap map;
+
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".HardwareStreaming"),
+ QVariant::fromValue(mPriv->adaptee->hardwareStreaming()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".InitialTransport"),
+ QVariant::fromValue(mPriv->adaptee->initialTransport()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".InitialAudio"),
+ QVariant::fromValue(mPriv->adaptee->initialAudio()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".InitialVideo"),
+ QVariant::fromValue(mPriv->adaptee->initialVideo()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".InitialAudioName"),
+ QVariant::fromValue(mPriv->adaptee->initialAudioName()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".InitialVideoName"),
+ QVariant::fromValue(mPriv->adaptee->initialVideoName()));
+ map.insert(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String(".MutableContents"),
+ QVariant::fromValue(mPriv->adaptee->mutableContents()));
+ return map;
}
-void BaseChannelGroupInterface::Adaptee::getAllMembers(const Tp::Service::ChannelInterfaceGroupAdaptor::GetAllMembersContextPtr &context)
+void BaseChannelCallType::createAdaptor()
{
- context->setFinished(mInterface->mPriv->members, mInterface->mPriv->getLocalPendingMembers(), mInterface->mPriv->remotePendingMembers);
+ (void) new Service::ChannelTypeCallAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
}
-void BaseChannelGroupInterface::Adaptee::getGroupFlags(const Tp::Service::ChannelInterfaceGroupAdaptor::GetGroupFlagsContextPtr &context)
+void BaseChannelCallType::setCallState(const Tp::CallState &state, uint flags, const Tp::CallStateReason &stateReason, const QVariantMap &callStateDetails)
{
- context->setFinished(mInterface->mPriv->flags);
+ mPriv->callState = state;
+ mPriv->callFlags = flags;
+ mPriv->callStateReason = stateReason;
+ mPriv->callStateDetails = callStateDetails;
+ QMetaObject::invokeMethod(mPriv->adaptee, "callStateChanged", Q_ARG(uint, state), Q_ARG(uint, flags), Q_ARG(Tp::CallStateReason, stateReason), Q_ARG(QVariantMap, callStateDetails));
}
-void BaseChannelGroupInterface::Adaptee::getHandleOwners(const Tp::UIntList& handles, const Tp::Service::ChannelInterfaceGroupAdaptor::GetHandleOwnersContextPtr &context)
+void BaseChannelCallType::setAcceptCallback(const AcceptCallback &cb)
{
- Tp::UIntList ret;
- foreach(uint handle, handles)
- ret.append(mInterface->mPriv->handleOwners.contains(handle) ? mInterface->mPriv->handleOwners[handle] : 0);
- context->setFinished(ret);
+ mPriv->acceptCB = cb;
}
-void BaseChannelGroupInterface::Adaptee::getLocalPendingMembers(const Tp::Service::ChannelInterfaceGroupAdaptor::GetLocalPendingMembersContextPtr &context)
+void BaseChannelCallType::setHangupCallback(const HangupCallback &cb)
{
- context->setFinished(mInterface->mPriv->getLocalPendingMembers());
+ mPriv->hangupCB = cb;
}
-void BaseChannelGroupInterface::Adaptee::getLocalPendingMembersWithInfo(const Tp::Service::ChannelInterfaceGroupAdaptor::GetLocalPendingMembersWithInfoContextPtr &context)
+void BaseChannelCallType::setSetRingingCallback(const SetRingingCallback &cb)
{
- context->setFinished(mInterface->mPriv->localPendingMembers);
+ mPriv->setRingingCB = cb;
}
-void BaseChannelGroupInterface::Adaptee::getMembers(const Tp::Service::ChannelInterfaceGroupAdaptor::GetMembersContextPtr &context)
+void BaseChannelCallType::setSetQueuedCallback(const SetQueuedCallback &cb)
{
- context->setFinished(mInterface->mPriv->members);
+ mPriv->setQueuedCB = cb;
}
-void BaseChannelGroupInterface::Adaptee::getRemotePendingMembers(const Tp::Service::ChannelInterfaceGroupAdaptor::GetRemotePendingMembersContextPtr &context)
+void BaseChannelCallType::setAddContentCallback(const AddContentCallback &cb)
{
- context->setFinished(mInterface->mPriv->remotePendingMembers);
+ mPriv->addContentCB = cb;
}
-void BaseChannelGroupInterface::Adaptee::getSelfHandle(const Tp::Service::ChannelInterfaceGroupAdaptor::GetSelfHandleContextPtr &context)
+void BaseChannelCallType::setMembersFlags(const Tp::CallMemberMap &flagsChanged, const Tp::HandleIdentifierMap &identifiers, const Tp::UIntList &removed, const Tp::CallStateReason &reason)
{
- context->setFinished(mInterface->mPriv->selfHandle);
+ mPriv->callMembers = flagsChanged;
+ mPriv->memberIdentifiers = identifiers;
+ QMetaObject::invokeMethod(mPriv->adaptee, "callMembersChanged", Q_ARG(Tp::CallMemberMap, flagsChanged), Q_ARG(Tp::HandleIdentifierMap, identifiers), Q_ARG(Tp::UIntList, removed), Q_ARG(Tp::CallStateReason, reason));
+}
+
+BaseCallContentPtr BaseChannelCallType::addContent(const QString &name, const Tp::MediaStreamType &type, const Tp::MediaStreamDirection &direction)
+{
+ BaseCallContentPtr ptr = BaseCallContent::create(mPriv->channel->dbusConnection(), mPriv->channel, name, type, direction);
+ DBusError error;
+ ptr->registerObject(&error);
+ QDBusObjectPath objpath;
+ objpath.setPath(ptr->objectPath());
+ mPriv->contents.append(objpath);
+ QMetaObject::invokeMethod(mPriv->adaptee, "contentAdded", Q_ARG(QDBusObjectPath, objpath));
+
+ return ptr;
+}
+
+void BaseChannelCallType::addContent(BaseCallContentPtr content)
+{
+ DBusError error;
+ content->registerObject(&error);
+ QDBusObjectPath objpath;
+ objpath.setPath(content->objectPath());
+ mPriv->contents.append(objpath);
+ QMetaObject::invokeMethod(mPriv->adaptee, "contentAdded", Q_ARG(QDBusObjectPath, objpath));
+}
+
+// Chan.I.Hold
+BaseChannelHoldInterface::Adaptee::Adaptee(BaseChannelHoldInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelHoldInterface::Adaptee::~Adaptee()
+{
+}
+
+struct TP_QT_NO_EXPORT BaseChannelHoldInterface::Private {
+ Private(BaseChannelHoldInterface *parent, Tp::LocalHoldState state)
+ : state(state),
+ reason(Tp::LocalHoldStateReasonNone),
+ adaptee(new BaseChannelHoldInterface::Adaptee(parent)) {
+ }
+
+ SetHoldStateCallback setHoldStateCB;
+ Tp::LocalHoldState state;
+ Tp::LocalHoldStateReason reason;
+ BaseChannelHoldInterface::Adaptee *adaptee;
+};
+
+void BaseChannelHoldInterface::Adaptee::getHoldState(const Tp::Service::ChannelInterfaceHoldAdaptor::GetHoldStateContextPtr &context)
+{
+ context->setFinished(mInterface->getHoldState(), mInterface->getHoldReason());
+}
+
+void BaseChannelHoldInterface::Adaptee::requestHold(bool hold, const Tp::Service::ChannelInterfaceHoldAdaptor::RequestHoldContextPtr &context)
+{
+ if (!mInterface->mPriv->setHoldStateCB.isValid()) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+
+ Tp::LocalHoldState state = hold ? Tp::LocalHoldStateHeld : Tp::LocalHoldStateUnheld;
+
+ DBusError error;
+ mInterface->mPriv->setHoldStateCB(state, Tp::LocalHoldStateReasonRequested, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
}
/**
- * \class BaseChannelGroupInterface
- * \ingroup servicecm
+ * \class BaseChannelHoldInterface
+ * \ingroup servicechannel
* \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
*
- * \brief Base class for implementations of Channel.Interface.Group
+ * \brief Base class for implementations of Channel.Interface.Hold
*
*/
/**
* Class constructor.
*/
-BaseChannelGroupInterface::BaseChannelGroupInterface(ChannelGroupFlags initialFlags, uint selfHandle)
- : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_GROUP),
- mPriv(new Private(this, initialFlags, selfHandle))
+BaseChannelHoldInterface::BaseChannelHoldInterface()
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_HOLD),
+ mPriv(new Private(this, Tp::LocalHoldStateUnheld))
{
}
+Tp::LocalHoldState BaseChannelHoldInterface::getHoldState() const
+{
+ return mPriv->state;
+}
+
+Tp::LocalHoldStateReason BaseChannelHoldInterface::getHoldReason() const
+{
+ return mPriv->reason;
+}
+
+void BaseChannelHoldInterface::setSetHoldStateCallback(const SetHoldStateCallback &cb)
+{
+ mPriv->setHoldStateCB = cb;
+}
+
+void BaseChannelHoldInterface::setHoldState(const Tp::LocalHoldState &state, const Tp::LocalHoldStateReason &reason)
+{
+ if (mPriv->state != state) {
+ mPriv->state = state;
+ mPriv->reason = reason;
+ QMetaObject::invokeMethod(mPriv->adaptee, "holdStateChanged", Q_ARG(uint, state), Q_ARG(uint, reason));
+ }
+}
+
/**
* Class destructor.
*/
-BaseChannelGroupInterface::~BaseChannelGroupInterface()
+BaseChannelHoldInterface::~BaseChannelHoldInterface()
+{
+ delete mPriv;
+}
+
+void BaseChannelHoldInterface::createAdaptor()
+{
+ (void) new Service::ChannelInterfaceHoldAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+
+// Chan.I.MergeableConference
+BaseChannelMergeableConferenceInterface::Adaptee::Adaptee(BaseChannelMergeableConferenceInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelMergeableConferenceInterface::Adaptee::~Adaptee()
+{
+}
+
+struct TP_QT_NO_EXPORT BaseChannelMergeableConferenceInterface::Private {
+ Private(BaseChannelMergeableConferenceInterface *parent)
+ :adaptee(new BaseChannelMergeableConferenceInterface::Adaptee(parent)) {
+ }
+
+ MergeCallback mergeCB;
+ BaseChannelMergeableConferenceInterface::Adaptee *adaptee;
+};
+
+void BaseChannelMergeableConferenceInterface::Adaptee::merge(const QDBusObjectPath &channelPath, const Tp::Service::ChannelInterfaceMergeableConferenceAdaptor::MergeContextPtr &context)
+{
+ if (!mInterface->mPriv->mergeCB.isValid()) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+
+ DBusError error;
+ mInterface->mPriv->mergeCB(channelPath, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+/**
+ * \class BaseChannelMergeableConferenceInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Interface.MergeableConference
+ *
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelMergeableConferenceInterface::BaseChannelMergeableConferenceInterface()
+ : AbstractChannelInterface(TP_QT_FUTURE_IFACE_CHANNEL_INTERFACE_MERGEABLE_CONFERENCE),
+ mPriv(new Private(this))
+{
+}
+
+void BaseChannelMergeableConferenceInterface::setMergeCallback(const MergeCallback &cb)
+{
+ mPriv->mergeCB = cb;
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelMergeableConferenceInterface::~BaseChannelMergeableConferenceInterface()
+{
+ delete mPriv;
+}
+
+void BaseChannelMergeableConferenceInterface::createAdaptor()
+{
+ (void) new Service::ChannelInterfaceMergeableConferenceAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+
+// Chan.I.Splittable
+BaseChannelSplittableInterface::Adaptee::Adaptee(BaseChannelSplittableInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelSplittableInterface::Adaptee::~Adaptee()
+{
+}
+
+struct TP_QT_NO_EXPORT BaseChannelSplittableInterface::Private {
+ Private(BaseChannelSplittableInterface *parent)
+ :adaptee(new BaseChannelSplittableInterface::Adaptee(parent)) {
+ }
+
+ SplitCallback splitCB;
+ BaseChannelSplittableInterface::Adaptee *adaptee;
+};
+
+void BaseChannelSplittableInterface::Adaptee::split(const Tp::Service::ChannelInterfaceSplittableAdaptor::SplitContextPtr &context)
+{
+ if (!mInterface->mPriv->splitCB.isValid()) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+
+ DBusError error;
+ mInterface->mPriv->splitCB(&error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+/**
+ * \class BaseChannelSplittableInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Interface.Splittable
+ *
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelSplittableInterface::BaseChannelSplittableInterface()
+ : AbstractChannelInterface(TP_QT_FUTURE_IFACE_CHANNEL_INTERFACE_SPLITTABLE),
+ mPriv(new Private(this))
+{
+}
+
+void BaseChannelSplittableInterface::setSplitCallback(const SplitCallback &cb)
+{
+ mPriv->splitCB = cb;
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelSplittableInterface::~BaseChannelSplittableInterface()
+{
+ delete mPriv;
+}
+
+void BaseChannelSplittableInterface::createAdaptor()
+{
+ (void) new Service::ChannelInterfaceSplittableAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+
+// Chan.I.Conference
+BaseChannelConferenceInterface::Adaptee::Adaptee(BaseChannelConferenceInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseChannelConferenceInterface::Adaptee::~Adaptee()
+{
+}
+
+struct TP_QT_NO_EXPORT BaseChannelConferenceInterface::Private {
+ Private(BaseChannelConferenceInterface *parent,
+ Tp::ObjectPathList initialChannels,
+ Tp::UIntList initialInviteeHandles,
+ QStringList initialInviteeIDs,
+ QString invitationMessage,
+ ChannelOriginatorMap originalChannels) :
+ channels(initialChannels),
+ initialChannels(initialChannels),
+ initialInviteeHandles(initialInviteeHandles),
+ initialInviteeIDs(initialInviteeIDs),
+ invitationMessage(invitationMessage),
+ originalChannels(originalChannels),
+ adaptee(new BaseChannelConferenceInterface::Adaptee(parent)) {
+ }
+ Tp::ObjectPathList channels;
+ Tp::ObjectPathList initialChannels;
+ Tp::UIntList initialInviteeHandles;
+ QStringList initialInviteeIDs;
+ QString invitationMessage;
+ ChannelOriginatorMap originalChannels;
+
+ BaseChannelConferenceInterface::Adaptee *adaptee;
+};
+
+/**
+ * \class BaseChannelConferenceInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Interface.Conference
+ *
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelConferenceInterface::BaseChannelConferenceInterface(Tp::ObjectPathList initialChannels,
+ Tp::UIntList initialInviteeHandles,
+ QStringList initialInviteeIDs,
+ QString invitationMessage,
+ ChannelOriginatorMap originalChannels)
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_CONFERENCE),
+ mPriv(new Private(this, initialChannels, initialInviteeHandles, initialInviteeIDs, invitationMessage, originalChannels))
+{
+}
+
+Tp::ObjectPathList BaseChannelConferenceInterface::channels() const
+{
+ return mPriv->channels;
+}
+
+Tp::ObjectPathList BaseChannelConferenceInterface::initialChannels() const
+{
+ return mPriv->initialChannels;
+}
+
+Tp::UIntList BaseChannelConferenceInterface::initialInviteeHandles() const
+{
+ return mPriv->initialInviteeHandles;
+}
+
+QStringList BaseChannelConferenceInterface::initialInviteeIDs() const
+{
+ return mPriv->initialInviteeIDs;
+}
+
+QString BaseChannelConferenceInterface::invitationMessage() const
+{
+ return mPriv->invitationMessage;
+}
+
+void BaseChannelConferenceInterface::mergeChannel(const QDBusObjectPath &channel, uint channelHandle, const QVariantMap &properties)
+{
+ mPriv->channels.append(channel);
+ if (channelHandle != 0) {
+ mPriv->originalChannels[channelHandle] = channel;
+ }
+ QMetaObject::invokeMethod(mPriv->adaptee, "channelMerged", Q_ARG(QDBusObjectPath, channel), Q_ARG(uint, channelHandle), Q_ARG(QVariantMap, properties));
+}
+
+
+void BaseChannelConferenceInterface::removeChannel(const QDBusObjectPath &channel, const QVariantMap& details)
+{
+ mPriv->channels.removeAll(channel);
+ if (mPriv->originalChannels.values().contains(channel)) {
+ mPriv->originalChannels.remove(mPriv->originalChannels.key(channel));
+ }
+ QMetaObject::invokeMethod(mPriv->adaptee, "channelRemoved", Q_ARG(QDBusObjectPath, channel), Q_ARG(QVariantMap, details));
+}
+
+ChannelOriginatorMap BaseChannelConferenceInterface::originalChannels() const
+{
+ return mPriv->originalChannels;
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelConferenceInterface::~BaseChannelConferenceInterface()
{
delete mPriv;
}
@@ -1176,61 +4486,129 @@ BaseChannelGroupInterface::~BaseChannelGroupInterface()
*
* \return The immutable properties of this interface.
*/
-QVariantMap BaseChannelGroupInterface::immutableProperties() const
+QVariantMap BaseChannelConferenceInterface::immutableProperties() const
{
QVariantMap map;
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_CONFERENCE + QLatin1String(".InitialChannels"),
+ QVariant::fromValue(initialChannels()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_CONFERENCE + QLatin1String(".InitialInviteeHandles"),
+ QVariant::fromValue(initialInviteeHandles()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_CONFERENCE + QLatin1String(".InitialInviteeIDs"),
+ QVariant::fromValue(initialInviteeIDs()));
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_CONFERENCE + QLatin1String(".InvitationMessage"),
+ QVariant::fromValue(invitationMessage()));
return map;
}
-void BaseChannelGroupInterface::createAdaptor()
+void BaseChannelConferenceInterface::createAdaptor()
{
- (void) new Service::ChannelInterfaceGroupAdaptor(dbusObject()->dbusConnection(),
+ (void) new Service::ChannelInterfaceConferenceAdaptor(dbusObject()->dbusConnection(),
mPriv->adaptee, dbusObject());
}
-void BaseChannelGroupInterface::setRemoveMembersCallback(const RemoveMembersCallback &cb)
+// Chan.I.SMS
+BaseChannelSMSInterface::Adaptee::Adaptee(BaseChannelSMSInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
{
- mPriv->removeMembersCB = cb;
}
-void BaseChannelGroupInterface::setAddMembersCallback(const AddMembersCallback &cb)
+BaseChannelSMSInterface::Adaptee::~Adaptee()
{
- mPriv->addMembersCB = cb;
}
-void BaseChannelGroupInterface::addMembers(const Tp::UIntList& handles, const QStringList& identifiers)
+struct TP_QT_NO_EXPORT BaseChannelSMSInterface::Private {
+ Private(BaseChannelSMSInterface *parent, bool flash, bool smsChannel)
+ : flash(flash),
+ smsChannel(smsChannel),
+ adaptee(new BaseChannelSMSInterface::Adaptee(parent))
+ {
+ }
+
+ bool flash;
+ bool smsChannel;
+ GetSMSLengthCallback getSMSLengthCB;
+ BaseChannelSMSInterface::Adaptee *adaptee;
+};
+
+void BaseChannelSMSInterface::Adaptee::getSMSLength(const Tp::MessagePartList & messages, const Tp::Service::ChannelInterfaceSMSAdaptor::GetSMSLengthContextPtr &context)
{
- if (handles.size() != identifiers.size()) {
- debug() << "BaseChannelGroupInterface::addMembers: handles.size() != identifiers.size()";
+ if (!mInterface->mPriv->getSMSLengthCB.isValid()) {
+ context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
return;
}
- Tp::UIntList added;
- for (int i = 0; i < handles.size(); ++i) {
- uint handle = handles[i];
- if (mPriv->members.contains(handle))
- continue;
- mPriv->memberIdentifiers[handle] = identifiers[i];
- mPriv->members.append(handle);
- added.append(handle);
+ DBusError error;
+ mInterface->mPriv->getSMSLengthCB(messages, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
}
- if (!added.isEmpty())
- QMetaObject::invokeMethod(mPriv->adaptee,"membersChanged",Q_ARG(QString, QString()), Q_ARG(Tp::UIntList, added), Q_ARG(Tp::UIntList, Tp::UIntList()), Q_ARG(Tp::UIntList, Tp::UIntList()), Q_ARG(Tp::UIntList, Tp::UIntList()), Q_ARG(uint, 0), Q_ARG(uint, ChannelGroupChangeReasonNone)); //Can simply use emit in Qt5
+ // TODO: implement
+ context->setFinished(0,0,0);
+}
+
+/**
+ * \class BaseChannelSMSInterface
+ * \ingroup servicechannel
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Interface.SMS
+ *
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelSMSInterface::BaseChannelSMSInterface(bool flash, bool smsChannel)
+ : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_SMS),
+ mPriv(new Private(this, flash, smsChannel))
+{
}
-void BaseChannelGroupInterface::removeMembers(const Tp::UIntList& handles)
+void BaseChannelSMSInterface::setGetSMSLengthCallback(const GetSMSLengthCallback &cb)
{
- Tp::UIntList removed;
- foreach(uint handle, handles) {
- if (mPriv->members.contains(handle))
- continue;
+ mPriv->getSMSLengthCB = cb;
+}
- mPriv->memberIdentifiers.remove(handle);
- mPriv->members.removeAll(handle);
- removed.append(handle);
- }
- if (!removed.isEmpty())
- QMetaObject::invokeMethod(mPriv->adaptee,"membersChanged",Q_ARG(QString, QString()), Q_ARG(Tp::UIntList, Tp::UIntList()), Q_ARG(Tp::UIntList, removed), Q_ARG(Tp::UIntList, Tp::UIntList()), Q_ARG(Tp::UIntList, Tp::UIntList()), Q_ARG(uint, 0), Q_ARG(uint,ChannelGroupChangeReasonNone)); //Can simply use emit in Qt5 //Can simply use emit in Qt5
+/**
+ * Class destructor.
+ */
+BaseChannelSMSInterface::~BaseChannelSMSInterface()
+{
+ delete mPriv;
+}
+
+bool BaseChannelSMSInterface::flash() const
+{
+ return mPriv->flash;
+}
+
+bool BaseChannelSMSInterface::smsChannel() const
+{
+ return mPriv->smsChannel;
+}
+
+/**
+ * Return the immutable properties of this interface.
+ *
+ * Immutable properties cannot change after the interface has been registered
+ * on a service on the bus with registerInterface().
+ *
+ * \return The immutable properties of this interface.
+ */
+QVariantMap BaseChannelSMSInterface::immutableProperties() const
+{
+ QVariantMap map;
+ map.insert(TP_QT_IFACE_CHANNEL_INTERFACE_SMS + QLatin1String(".Flash"),
+ QVariant::fromValue(mPriv->adaptee->flash()));
+ return map;
+}
+
+void BaseChannelSMSInterface::createAdaptor()
+{
+ (void) new Service::ChannelInterfaceSMSAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
}
}
diff --git a/TelepathyQt/base-channel.h b/TelepathyQt/base-channel.h
index a877b6ff..a06f3d91 100644
--- a/TelepathyQt/base-channel.h
+++ b/TelepathyQt/base-channel.h
@@ -39,24 +39,26 @@ class QString;
namespace Tp
{
-class BaseChannel : public DBusService
+class TP_QT_EXPORT BaseChannel : public DBusService
{
Q_OBJECT
Q_DISABLE_COPY(BaseChannel)
public:
- static BaseChannelPtr create(BaseConnection* connection, const QString &channelType,
- uint targetHandle, uint targetHandleType) {
+ static BaseChannelPtr create(BaseConnection *connection, const QString &channelType,
+ Tp::HandleType targetHandleType = Tp::HandleTypeNone, uint targetHandle = 0) {
return BaseChannelPtr(new BaseChannel(QDBusConnection::sessionBus(), connection,
- channelType, targetHandle, targetHandleType));
+ channelType, targetHandleType, targetHandle));
}
- virtual ~BaseChannel();
+ ~BaseChannel() override;
- QVariantMap immutableProperties() const;
- bool registerObject(DBusError *error = NULL);
+ QVariantMap immutableProperties() const override;
+ bool registerObject(DBusError *error = nullptr);
virtual QString uniqueName() const;
+ Tp::BaseConnection *connection() const;
+
QString channelType() const;
QList<AbstractChannelInterfacePtr> interfaces() const;
AbstractChannelInterfacePtr interface(const QString &interfaceName) const;
@@ -73,20 +75,22 @@ public:
void setTargetID(const QString &targetID);
void setRequested(bool requested);
+ void close();
+
bool plugInterface(const AbstractChannelInterfacePtr &interface);
Q_SIGNALS:
void closed();
protected:
- BaseChannel(const QDBusConnection &dbusConnection, BaseConnection* connection,
- const QString &channelType, uint targetHandle, uint targetHandleType);
- virtual bool registerObject(const QString &busName, const QString &objectPath,
- DBusError *error);
+ BaseChannel(const QDBusConnection &dbusConnection, BaseConnection *connection,
+ const QString &channelType, uint targetHandleType, uint targetHandle);
+ bool registerObject(const QString &busName, const QString &objectPath,
+ DBusError *error) override;
private:
class Adaptee;
friend class Adaptee;
- class Private;
- friend class Private;
+ struct Private;
+ friend struct Private;
Private *mPriv;
};
@@ -97,14 +101,19 @@ class TP_QT_EXPORT AbstractChannelInterface : public AbstractDBusServiceInterfac
public:
AbstractChannelInterface(const QString &interfaceName);
- virtual ~AbstractChannelInterface();
+ ~AbstractChannelInterface() override;
+
+protected:
+ virtual void close();
+ virtual void setBaseChannel(BaseChannel *channel);
private:
friend class BaseChannel;
- class Private;
- friend class Private;
+ struct Private;
+ friend struct Private;
Private *mPriv;
+
};
class TP_QT_EXPORT BaseChannelTextType : public AbstractChannelInterface
@@ -122,33 +131,26 @@ public:
new BaseChannelTextTypeSubclass(channel));
}
- typedef Callback2<QDBusObjectPath, const QVariantMap&, DBusError*> CreateChannelCallback;
- CreateChannelCallback createChannel;
-
- typedef Callback2<bool, const QVariantMap&, DBusError*> EnsureChannelCallback;
- EnsureChannelCallback ensureChannel;
-
- virtual ~BaseChannelTextType();
-
- QVariantMap immutableProperties() const;
-
- Tp::RequestableChannelClassList requestableChannelClasses;
+ ~BaseChannelTextType() override;
typedef Callback1<void, QString> MessageAcknowledgedCallback;
void setMessageAcknowledgedCallback(const MessageAcknowledgedCallback &cb);
- Tp::MessagePartListList pendingMessages();
+ Tp::MessagePartListList pendingMessages() const;
/* Convenience function */
void addReceivedMessage(const Tp::MessagePartList &message);
+ void acknowledgePendingMessages(const QStringList &tokens, DBusError *error);
+
private Q_SLOTS:
void sent(uint timestamp, uint type, QString text);
protected:
BaseChannelTextType(BaseChannel* channel);
- void acknowledgePendingMessages(const Tp::UIntList &IDs, DBusError* error);
+ void acknowledgePendingMessages(const Tp::UIntList &IDs, DBusError *error);
+ void removePendingMessages(const Tp::UIntList &IDs);
private:
- void createAdaptor();
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -179,15 +181,15 @@ public:
return SharedPtr<BaseChannelMessagesInterfaceSubclass>(
new BaseChannelMessagesInterfaceSubclass());
}
- virtual ~BaseChannelMessagesInterface();
+ ~BaseChannelMessagesInterface() override;
- QVariantMap immutableProperties() const;
+ QVariantMap immutableProperties() const override;
QStringList supportedContentTypes();
Tp::UIntList messageTypes();
uint messagePartSupportFlags();
uint deliveryReportingSupport();
- Tp::MessagePartListList pendingMessages();
+ Tp::MessagePartListList pendingMessages() const;
void messageSent(const Tp::MessagePartList &content, uint flags, const QString &messageToken);
@@ -204,7 +206,139 @@ private:
Tp::UIntList messageTypes,
uint messagePartSupportFlags,
uint deliveryReportingSupport);
- void createAdaptor();
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelFileTransferType : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelFileTransferType)
+
+public:
+ enum Direction {
+ Incoming,
+ Outgoing
+ };
+
+ static BaseChannelFileTransferTypePtr create(const QVariantMap &request)
+ {
+ return BaseChannelFileTransferTypePtr(new BaseChannelFileTransferType(request));
+ }
+ template<typename BaseChannelFileTransferTypeSubclass>
+ static SharedPtr<BaseChannelFileTransferTypeSubclass> create(const QVariantMap &request)
+ {
+ return SharedPtr<BaseChannelFileTransferTypeSubclass>(
+ new BaseChannelFileTransferTypeSubclass(request));
+ }
+
+ ~BaseChannelFileTransferType() override;
+
+ QVariantMap immutableProperties() const override;
+ Direction direction() const;
+
+ QString contentType() const;
+ QString filename() const;
+ qulonglong size() const;
+ uint contentHashType() const;
+ QString contentHash() const;
+ QString description() const;
+ QDateTime date() const;
+ virtual Tp::SupportedSocketMap availableSocketTypes() const;
+
+ uint state() const;
+ void setState(uint state, uint reason);
+
+ qulonglong transferredBytes() const;
+ void setTransferredBytes(qulonglong count);
+ qulonglong initialOffset() const;
+
+ QString uri() const;
+
+ QString fileCollection() const;
+ void setFileCollection(const QString &fileCollection);
+
+ bool remoteAcceptFile(QIODevice *output, qulonglong offset);
+ bool remoteProvideFile(QIODevice *input, qulonglong deviceOffset = 0);
+
+Q_SIGNALS:
+ void stateChanged(uint state, uint reason);
+ void uriDefined(const QString &uri);
+
+protected:
+ BaseChannelFileTransferType(const QVariantMap &request);
+
+ virtual bool createSocket(uint addressType, uint accessControl, const QDBusVariant &accessControlParam, DBusError *error);
+ virtual QDBusVariant socketAddress() const;
+
+ void setClientSocket(QIODevice *socket);
+
+ void close() override; // Add Q_DECL_OVERRIDE in Qt5
+
+private Q_SLOTS:
+ TP_QT_NO_EXPORT void onSocketConnection();
+ TP_QT_NO_EXPORT void doTransfer();
+ TP_QT_NO_EXPORT void onBytesWritten(qint64 count);
+
+private:
+ TP_QT_NO_EXPORT void setUri(const QString &uri);
+ TP_QT_NO_EXPORT void tryToOpenAndTransfer();
+
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelRoomListType : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelRoomListType)
+
+public:
+ static BaseChannelRoomListTypePtr create(const QString &server = QString())
+ {
+ return BaseChannelRoomListTypePtr(new BaseChannelRoomListType(server));
+ }
+ template<typename BaseChannelRoomListTypeSubclass>
+ static SharedPtr<BaseChannelRoomListTypeSubclass> create(const QString &server = QString())
+ {
+ return SharedPtr<BaseChannelRoomListTypeSubclass>(
+ new BaseChannelRoomListTypeSubclass(server));
+ }
+
+ ~BaseChannelRoomListType() override;
+
+ QVariantMap immutableProperties() const override;
+
+ QString server() const;
+
+ bool getListingRooms();
+ void setListingRooms(bool listing);
+
+ typedef Callback1<void, DBusError*> ListRoomsCallback;
+ void setListRoomsCallback(const ListRoomsCallback &cb);
+ void listRooms(DBusError *error);
+
+ typedef Callback1<void, DBusError*> StopListingCallback;
+ void setStopListingCallback(const StopListingCallback &cb);
+ void stopListing(DBusError *error);
+
+ void gotRooms(const Tp::RoomInfoList &rooms);
+
+protected:
+ BaseChannelRoomListType(const QString &server);
+
+private:
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -227,13 +361,13 @@ public:
return SharedPtr<BaseChannelServerAuthenticationTypeSubclass>(
new BaseChannelServerAuthenticationTypeSubclass(authenticationMethod));
}
- virtual ~BaseChannelServerAuthenticationType();
+ ~BaseChannelServerAuthenticationType() override;
- QVariantMap immutableProperties() const;
+ QVariantMap immutableProperties() const override;
private Q_SLOTS:
private:
BaseChannelServerAuthenticationType(const QString &authenticationMethod);
- void createAdaptor();
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -256,9 +390,9 @@ public:
return SharedPtr<BaseChannelCaptchaAuthenticationInterfaceSubclass>(
new BaseChannelCaptchaAuthenticationInterfaceSubclass(canRetryCaptcha));
}
- virtual ~BaseChannelCaptchaAuthenticationInterface();
+ ~BaseChannelCaptchaAuthenticationInterface() override;
- QVariantMap immutableProperties() const;
+ QVariantMap immutableProperties() const override;
typedef Callback4<void, Tp::CaptchaInfoList&, uint&, QString&, DBusError*> GetCaptchasCallback;
void setGetCaptchasCallback(const GetCaptchasCallback &cb);
@@ -278,7 +412,191 @@ public:
private Q_SLOTS:
private:
BaseChannelCaptchaAuthenticationInterface(bool canRetryCaptcha);
- void createAdaptor();
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelSASLAuthenticationInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelSASLAuthenticationInterface)
+
+public:
+ static BaseChannelSASLAuthenticationInterfacePtr create(const QStringList &availableMechanisms,
+ bool hasInitialData,
+ bool canTryAgain,
+ const QString &authorizationIdentity,
+ const QString &defaultUsername,
+ const QString &defaultRealm,
+ bool maySaveResponse)
+ {
+ return BaseChannelSASLAuthenticationInterfacePtr(new BaseChannelSASLAuthenticationInterface(availableMechanisms,
+ hasInitialData,
+ canTryAgain,
+ authorizationIdentity,
+ defaultUsername,
+ defaultRealm,
+ maySaveResponse));
+ }
+ template<typename BaseChannelSASLAuthenticationInterfaceSubclass>
+ static SharedPtr<BaseChannelSASLAuthenticationInterfaceSubclass> create(const QStringList &availableMechanisms,
+ bool hasInitialData,
+ bool canTryAgain,
+ const QString &authorizationIdentity,
+ const QString &defaultUsername,
+ const QString &defaultRealm,
+ bool maySaveResponse)
+ {
+ return SharedPtr<BaseChannelSASLAuthenticationInterfaceSubclass>(
+ new BaseChannelSASLAuthenticationInterfaceSubclass(availableMechanisms,
+ hasInitialData,
+ canTryAgain,
+ authorizationIdentity,
+ defaultUsername,
+ defaultRealm,
+ maySaveResponse));
+ }
+
+ ~BaseChannelSASLAuthenticationInterface() override;
+
+ QVariantMap immutableProperties() const override;
+
+ QStringList availableMechanisms() const;
+ bool hasInitialData() const;
+ bool canTryAgain() const;
+ QString authorizationIdentity() const;
+ QString defaultUsername() const;
+ QString defaultRealm() const;
+ bool maySaveResponse() const;
+
+ uint saslStatus() const;
+ void setSaslStatus(uint status, const QString &reason, const QVariantMap &details);
+
+ QString saslError() const;
+ void setSaslError(const QString &saslError);
+
+ QVariantMap saslErrorDetails() const;
+ void setSaslErrorDetails(const QVariantMap &saslErrorDetails);
+
+ typedef Callback2<void, const QString &, DBusError*> StartMechanismCallback;
+ void setStartMechanismCallback(const StartMechanismCallback &cb);
+ void startMechanism(const QString &mechanism, DBusError *error);
+
+ typedef Callback3<void, const QString &, const QByteArray &, DBusError*> StartMechanismWithDataCallback;
+ void setStartMechanismWithDataCallback(const StartMechanismWithDataCallback &cb);
+ void startMechanismWithData(const QString &mechanism, const QByteArray &initialData, DBusError *error);
+
+ typedef Callback2<void, const QByteArray &, DBusError*> RespondCallback;
+ void setRespondCallback(const RespondCallback &cb);
+ void respond(const QByteArray &responseData, DBusError *error);
+
+ typedef Callback1<void, DBusError*> AcceptSASLCallback;
+ void setAcceptSaslCallback(const AcceptSASLCallback &cb);
+ void acceptSasl(DBusError *error);
+
+ typedef Callback3<void, uint, const QString &, DBusError*> AbortSASLCallback;
+ void setAbortSaslCallback(const AbortSASLCallback &cb);
+ void abortSasl(uint reason, const QString &debugMessage, DBusError *error);
+
+ void newChallenge(const QByteArray &challengeData);
+
+protected:
+ BaseChannelSASLAuthenticationInterface(const QStringList &availableMechanisms,
+ bool hasInitialData,
+ bool canTryAgain,
+ const QString &authorizationIdentity,
+ const QString &defaultUsername,
+ const QString &defaultRealm,
+ bool maySaveResponse);
+
+private:
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelSecurableInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelSecurableInterface)
+
+public:
+ static BaseChannelSecurableInterfacePtr create()
+ {
+ return BaseChannelSecurableInterfacePtr(new BaseChannelSecurableInterface());
+ }
+ template<typename BaseChannelSecurableInterfaceSubclass>
+ static SharedPtr<BaseChannelSecurableInterfaceSubclass> create()
+ {
+ return SharedPtr<BaseChannelSecurableInterfaceSubclass>(
+ new BaseChannelSecurableInterfaceSubclass());
+ }
+
+ ~BaseChannelSecurableInterface() override;
+
+ QVariantMap immutableProperties() const override;
+
+ bool encrypted() const;
+ void setEncrypted(bool encrypted);
+
+ bool verified() const;
+ void setVerified(bool verified);
+
+protected:
+ BaseChannelSecurableInterface();
+
+private:
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelChatStateInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelChatStateInterface)
+
+public:
+ static BaseChannelChatStateInterfacePtr create()
+ {
+ return BaseChannelChatStateInterfacePtr(new BaseChannelChatStateInterface());
+ }
+ template<typename BaseChannelChatStateInterfaceSubclass>
+ static SharedPtr<BaseChannelChatStateInterfaceSubclass> create()
+ {
+ return SharedPtr<BaseChannelChatStateInterfaceSubclass>(
+ new BaseChannelChatStateInterfaceSubclass());
+ }
+
+ ~BaseChannelChatStateInterface() override;
+
+ Tp::ChatStateMap chatStates() const;
+ void setChatStates(const Tp::ChatStateMap &chatStates);
+
+ typedef Callback2<void, uint, DBusError*> SetChatStateCallback;
+ void setSetChatStateCallback(const SetChatStateCallback &cb);
+ void setChatState(uint state, DBusError *error);
+
+ void chatStateChanged(uint contact, uint state);
+
+protected:
+ BaseChannelChatStateInterface();
+
+private:
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -293,32 +611,481 @@ class TP_QT_EXPORT BaseChannelGroupInterface : public AbstractChannelInterface
Q_DISABLE_COPY(BaseChannelGroupInterface)
public:
- static BaseChannelGroupInterfacePtr create(ChannelGroupFlags initialFlags, uint selfHandle) {
- return BaseChannelGroupInterfacePtr(new BaseChannelGroupInterface(initialFlags, selfHandle));
+ static BaseChannelGroupInterfacePtr create()
+ {
+ return BaseChannelGroupInterfacePtr(new BaseChannelGroupInterface());
}
template<typename BaseChannelGroupInterfaceSubclass>
- static SharedPtr<BaseChannelGroupInterfaceSubclass> create(ChannelGroupFlags initialFlags, uint selfHandle) {
+ static SharedPtr<BaseChannelGroupInterfaceSubclass> create()
+ {
return SharedPtr<BaseChannelGroupInterfaceSubclass>(
- new BaseChannelGroupInterfaceSubclass(initialFlags, selfHandle));
+ new BaseChannelGroupInterfaceSubclass());
}
- virtual ~BaseChannelGroupInterface();
- QVariantMap immutableProperties() const;
+ ~BaseChannelGroupInterface() override;
- typedef Callback3<void, const Tp::UIntList&, const QString&, DBusError*> RemoveMembersCallback;
- void setRemoveMembersCallback(const RemoveMembersCallback &cb);
+ Tp::ChannelGroupFlags groupFlags() const;
+ void setGroupFlags(const Tp::ChannelGroupFlags &flags);
+
+ Tp::UIntList members() const;
+ void setMembers(const Tp::UIntList &members, const QVariantMap &details);
+ void setMembers(const Tp::UIntList &members, const Tp::LocalPendingInfoList &localPending, const Tp::UIntList &remotePending, const QVariantMap &details);
+
+ Tp::HandleOwnerMap handleOwners() const;
+ void setHandleOwners(const Tp::HandleOwnerMap &handleOwners);
+
+ Tp::LocalPendingInfoList localPendingMembers() const;
+ void setLocalPendingMembers(const Tp::LocalPendingInfoList &localPendingMembers);
+
+ Tp::UIntList remotePendingMembers() const;
+ void setRemotePendingMembers(const Tp::UIntList &remotePendingMembers);
- typedef Callback3<void, const Tp::UIntList&, const QString&, DBusError*> AddMembersCallback;
+ uint selfHandle() const;
+ void setSelfHandle(uint selfHandle);
+
+ Tp::HandleIdentifierMap memberIdentifiers() const;
+
+ typedef Callback3<void, const Tp::UIntList &, const QString &, DBusError*> AddMembersCallback;
void setAddMembersCallback(const AddMembersCallback &cb);
+ void addMembers(const Tp::UIntList &contacts, const QString &message, DBusError *error);
- /* Adds a contact to this group. No-op if already in this group */
- void addMembers(const Tp::UIntList &handles, const QStringList &identifiers);
- void removeMembers(const Tp::UIntList &handles);
+ typedef Callback4<void, const Tp::UIntList &, const QString &, uint, DBusError*> RemoveMembersCallback;
+ void setRemoveMembersCallback(const RemoveMembersCallback &cb);
+ void removeMembers(const Tp::UIntList &contacts, const QString &message, uint reason, DBusError *error);
+
+protected:
+ BaseChannelGroupInterface();
+ void setBaseChannel(BaseChannel *channel) override;
+
+private:
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelRoomInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelRoomInterface)
+
+public:
+ static BaseChannelRoomInterfacePtr create(const QString &roomName,
+ const QString &server,
+ const QString &creator,
+ uint creatorHandle,
+ const QDateTime &creationTimestamp)
+ {
+ return BaseChannelRoomInterfacePtr(new BaseChannelRoomInterface(roomName,
+ server,
+ creator,
+ creatorHandle,
+ creationTimestamp));
+ }
+ template<typename BaseChannelRoomInterfaceSubclass>
+ static SharedPtr<BaseChannelRoomInterfaceSubclass> create(const QString &roomName,
+ const QString &server,
+ const QString &creator,
+ uint creatorHandle,
+ const QDateTime &creationTimestamp)
+ {
+ return SharedPtr<BaseChannelRoomInterfaceSubclass>(
+ new BaseChannelRoomInterfaceSubclass(roomName,
+ server,
+ creator,
+ creatorHandle,
+ creationTimestamp));
+ }
+
+ ~BaseChannelRoomInterface() override;
+
+ QVariantMap immutableProperties() const override;
+
+ QString roomName() const;
+ QString server() const;
+ QString creator() const;
+ uint creatorHandle() const;
+ QDateTime creationTimestamp() const;
+
+protected:
+ BaseChannelRoomInterface(const QString &roomName,
+ const QString &server,
+ const QString &creator,
+ uint creatorHandle,
+ const QDateTime &creationTimestamp);
+
+private:
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelRoomConfigInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelRoomConfigInterface)
+
+public:
+ static BaseChannelRoomConfigInterfacePtr create()
+ {
+ return BaseChannelRoomConfigInterfacePtr(new BaseChannelRoomConfigInterface());
+ }
+ template<typename BaseChannelRoomConfigInterfaceSubclass>
+ static SharedPtr<BaseChannelRoomConfigInterfaceSubclass> create()
+ {
+ return SharedPtr<BaseChannelRoomConfigInterfaceSubclass>(
+ new BaseChannelRoomConfigInterfaceSubclass());
+ }
+
+ ~BaseChannelRoomConfigInterface() override;
+
+ bool anonymous() const;
+ void setAnonymous(bool anonymous);
+
+ bool inviteOnly() const;
+ void setInviteOnly(bool inviteOnly);
+
+ uint limit() const;
+ void setLimit(uint limit);
+
+ bool moderated() const;
+ void setModerated(bool moderated);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ QString description() const;
+ void setDescription(const QString &description);
+
+ bool persistent() const;
+ void setPersistent(bool persistent);
+
+ bool isPrivate() const;
+ void setPrivate(bool newPrivate);
+
+ bool passwordProtected() const;
+ void setPasswordProtected(bool passwordProtected);
+
+ QString password() const;
+ void setPassword(const QString &password);
+
+ QString passwordHint() const;
+ void setPasswordHint(const QString &passwordHint);
+
+ bool canUpdateConfiguration() const;
+ void setCanUpdateConfiguration(bool canUpdateConfiguration);
+
+ QStringList mutableProperties() const;
+ void setMutableProperties(const QStringList &mutableProperties);
+
+ bool configurationRetrieved() const;
+ void setConfigurationRetrieved(bool configurationRetrieved);
+
+ typedef Callback2<void, const QVariantMap &, DBusError*> UpdateConfigurationCallback;
+ void setUpdateConfigurationCallback(const UpdateConfigurationCallback &cb);
+ void updateConfiguration(const QVariantMap &properties, DBusError *error);
+
+protected:
+ BaseChannelRoomConfigInterface();
+
+private:
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelCallType : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelCallType)
+
+public:
+ static BaseChannelCallTypePtr create(BaseChannel* channel, bool hardwareStreaming,
+ uint initialTransport,
+ bool initialAudio,
+ bool initialVideo,
+ QString initialAudioName,
+ QString initialVideoName,
+ bool mutableContents = false) {
+ return BaseChannelCallTypePtr(new BaseChannelCallType(channel,
+ hardwareStreaming,
+ initialTransport,
+ initialAudio,
+ initialVideo,
+ initialAudioName,
+ initialVideoName,
+ mutableContents));
+ }
+ template<typename BaseChannelCallTypeSubclass>
+ static SharedPtr<BaseChannelCallTypeSubclass> create(BaseChannel* channel, bool hardwareStreaming,
+ uint initialTransport,
+ bool initialAudio,
+ bool initialVideo,
+ QString initialAudioName,
+ QString initialVideoName,
+ bool mutableContents = false) {
+ return SharedPtr<BaseChannelCallTypeSubclass>(
+ new BaseChannelCallTypeSubclass(channel,
+ hardwareStreaming,
+ initialTransport,
+ initialAudio,
+ initialVideo,
+ initialAudioName,
+ initialVideoName,
+ mutableContents));
+ }
+
+ typedef Callback2<QDBusObjectPath, const QVariantMap&, DBusError*> CreateChannelCallback;
+ CreateChannelCallback createChannel;
+
+ typedef Callback2<bool, const QVariantMap&, DBusError*> EnsureChannelCallback;
+ EnsureChannelCallback ensureChannel;
+
+ ~BaseChannelCallType() override;
+
+ QVariantMap immutableProperties() const override;
+
+ Tp::ObjectPathList contents();
+ QVariantMap callStateDetails();
+ uint callState();
+ uint callFlags();
+ Tp::CallStateReason callStateReason();
+ bool hardwareStreaming();
+ Tp::CallMemberMap callMembers();
+ Tp::HandleIdentifierMap memberIdentifiers();
+ uint initialTransport();
+ bool initialAudio();
+ bool initialVideo();
+ QString initialAudioName();
+ QString initialVideoName();
+ bool mutableContents();
+
+ typedef Callback1<void, DBusError*> AcceptCallback;
+ void setAcceptCallback(const AcceptCallback &cb);
+
+ typedef Callback4<void, uint, const QString &, const QString &, DBusError*> HangupCallback;
+ void setHangupCallback(const HangupCallback &cb);
+
+ typedef Callback1<void, DBusError*> SetRingingCallback;
+ void setSetRingingCallback(const SetRingingCallback &cb);
+
+ typedef Callback1<void, DBusError*> SetQueuedCallback;
+ void setSetQueuedCallback(const SetQueuedCallback &cb);
+
+ typedef Callback4<QDBusObjectPath, const QString&, const Tp::MediaStreamType&, const Tp::MediaStreamDirection&, DBusError*> AddContentCallback;
+ void setAddContentCallback(const AddContentCallback &cb);
+
+ void setCallState(const Tp::CallState &state, uint flags, const Tp::CallStateReason &stateReason, const QVariantMap &callStateDetails);
+ void setMembersFlags(const Tp::CallMemberMap &flagsChanged, const Tp::HandleIdentifierMap &identifiers, const Tp::UIntList &removed, const Tp::CallStateReason &reason);
+ BaseCallContentPtr addContent(const QString &name, const Tp::MediaStreamType &type, const Tp::MediaStreamDirection &direction);
+ void addContent(BaseCallContentPtr content);
+
+ Tp::RequestableChannelClassList requestableChannelClasses;
+
+protected:
+ BaseChannelCallType(BaseChannel* channel,
+ bool hardwareStreaming,
+ uint initialTransport,
+ bool initialAudio,
+ bool initialVideo,
+ QString initialAudioName,
+ QString initialVideoName,
+ bool mutableContents = false);
+
+private:
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelHoldInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelHoldInterface)
+
+public:
+ static BaseChannelHoldInterfacePtr create() {
+ return BaseChannelHoldInterfacePtr(new BaseChannelHoldInterface());
+ }
+ template<typename BaseChannelHoldInterfaceSubclass>
+ static SharedPtr<BaseChannelHoldInterfaceSubclass> create() {
+ return SharedPtr<BaseChannelHoldInterfaceSubclass>(
+ new BaseChannelHoldInterfaceSubclass());
+ }
+ ~BaseChannelHoldInterface() override;
+
+ Tp::LocalHoldState getHoldState() const;
+ Tp::LocalHoldStateReason getHoldReason() const;
+ void setHoldState(const Tp::LocalHoldState &state, const Tp::LocalHoldStateReason &reason);
+
+ typedef Callback3<void, const Tp::LocalHoldState&, const Tp::LocalHoldStateReason &, DBusError*> SetHoldStateCallback;
+ void setSetHoldStateCallback(const SetHoldStateCallback &cb);
+Q_SIGNALS:
+ void holdStateChanged(const Tp::LocalHoldState &state, const Tp::LocalHoldStateReason &reason);
+private:
+ BaseChannelHoldInterface();
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelMergeableConferenceInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelMergeableConferenceInterface)
+
+public:
+ static BaseChannelMergeableConferenceInterfacePtr create() {
+ return BaseChannelMergeableConferenceInterfacePtr(new BaseChannelMergeableConferenceInterface());
+ }
+ template<typename BaseChannelMergeableConferenceInterfaceSubclass>
+ static SharedPtr<BaseChannelMergeableConferenceInterfaceSubclass> create() {
+ return SharedPtr<BaseChannelMergeableConferenceInterfaceSubclass>(
+ new BaseChannelMergeableConferenceInterfaceSubclass());
+ }
+ ~BaseChannelMergeableConferenceInterface() override;
+
+ void merge(const QDBusObjectPath &channel);
+
+ typedef Callback2<void, const QDBusObjectPath&, DBusError*> MergeCallback;
+ void setMergeCallback(const MergeCallback &cb);
+private:
+ BaseChannelMergeableConferenceInterface();
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelSplittableInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelSplittableInterface)
+
+public:
+ static BaseChannelSplittableInterfacePtr create() {
+ return BaseChannelSplittableInterfacePtr(new BaseChannelSplittableInterface());
+ }
+ template<typename BaseChannelSplittableInterfaceSubclass>
+ static SharedPtr<BaseChannelSplittableInterfaceSubclass> create() {
+ return SharedPtr<BaseChannelSplittableInterfaceSubclass>(
+ new BaseChannelSplittableInterfaceSubclass());
+ }
+ ~BaseChannelSplittableInterface() override;
+
+ void split();
+
+ typedef Callback1<void, DBusError*> SplitCallback;
+ void setSplitCallback(const SplitCallback &cb);
+private:
+ BaseChannelSplittableInterface();
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelConferenceInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelConferenceInterface)
+
+public:
+ static BaseChannelConferenceInterfacePtr create(Tp::ObjectPathList initialChannels = Tp::ObjectPathList(),
+ Tp::UIntList initialInviteeHandles = Tp::UIntList(),
+ QStringList initialInviteeIDs = QStringList(),
+ QString invitationMessage = QString(),
+ ChannelOriginatorMap originalChannels = ChannelOriginatorMap()) {
+ return BaseChannelConferenceInterfacePtr(new BaseChannelConferenceInterface(initialChannels, initialInviteeHandles, initialInviteeIDs, invitationMessage, originalChannels));
+ }
+ template<typename BaseChannelConferenceInterfaceSubclass>
+ static SharedPtr<BaseChannelConferenceInterfaceSubclass> create(Tp::ObjectPathList initialChannels = Tp::ObjectPathList(),
+ Tp::UIntList initialInviteeHandles = Tp::UIntList(),
+ QStringList initialInviteeIDs = QStringList(),
+ QString invitationMessage = QString(),
+ ChannelOriginatorMap originalChannels = ChannelOriginatorMap()) {
+ return SharedPtr<BaseChannelConferenceInterfaceSubclass>(
+ new BaseChannelConferenceInterfaceSubclass(initialChannels, initialInviteeHandles, initialInviteeIDs, invitationMessage, originalChannels));
+ }
+ ~BaseChannelConferenceInterface() override;
+
+ QVariantMap immutableProperties() const override;
+ Tp::ObjectPathList channels() const;
+ Tp::ObjectPathList initialChannels() const;
+ Tp::UIntList initialInviteeHandles() const;
+ QStringList initialInviteeIDs() const;
+ QString invitationMessage() const;
+ ChannelOriginatorMap originalChannels() const;
+
+ void mergeChannel(const QDBusObjectPath &channel, uint channelHandle, const QVariantMap &properties);
+ void removeChannel(const QDBusObjectPath &channel, const QVariantMap &details);
+
+private:
+ BaseChannelConferenceInterface(Tp::ObjectPathList initialChannels, Tp::UIntList initialInviteeHandles, QStringList initialInviteeIDs, QString invitationMessage, ChannelOriginatorMap originalChannels);
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseChannelSMSInterface : public AbstractChannelInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseChannelSMSInterface)
+
+public:
+ static BaseChannelSMSInterfacePtr create(bool flash, bool smsChannel) {
+ return BaseChannelSMSInterfacePtr(new BaseChannelSMSInterface(flash, smsChannel));
+ }
+ template<typename BaseChannelSMSInterfaceSubclass>
+ static SharedPtr<BaseChannelSMSInterfaceSubclass> create(bool flash, bool smsChannel) {
+ return SharedPtr<BaseChannelSMSInterfaceSubclass>(
+ new BaseChannelSMSInterfaceSubclass(flash, smsChannel));
+ }
+ ~BaseChannelSMSInterface() override;
+
+ QVariantMap immutableProperties() const override;
+
+ typedef Callback2<void, const Tp::MessagePartList &, DBusError*> GetSMSLengthCallback;
+ void setGetSMSLengthCallback(const GetSMSLengthCallback &cb);
+
+ bool flash() const;
+ bool smsChannel() const;
+
+Q_SIGNALS:
+ void smsChannelChanged(bool smsChannel);
-private Q_SLOTS:
private:
- BaseChannelGroupInterface(ChannelGroupFlags initialFlags, uint selfHandle);
- void createAdaptor();
+ BaseChannelSMSInterface(bool flash, bool smsChannel);
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
diff --git a/TelepathyQt/base-connection-internal.h b/TelepathyQt/base-connection-internal.h
index a667f870..36439458 100644
--- a/TelepathyQt/base-connection-internal.h
+++ b/TelepathyQt/base-connection-internal.h
@@ -33,63 +33,63 @@ namespace Tp
class TP_QT_NO_EXPORT BaseConnection::Adaptee : public QObject
{
Q_OBJECT
-
Q_PROPERTY(QStringList interfaces READ interfaces)
Q_PROPERTY(uint selfHandle READ selfHandle)
+ Q_PROPERTY(QString selfID READ selfID)
Q_PROPERTY(uint status READ status)
Q_PROPERTY(bool hasImmortalHandles READ hasImmortalHandles)
+
public:
- Adaptee(const QDBusConnection &dbusConnection, BaseConnection *cm);
- ~Adaptee();
+ Adaptee(const QDBusConnection &dbusConnection, BaseConnection *connection);
+ ~Adaptee() override;
QStringList interfaces() const;
- uint status() const {
- return mConnection->status();
- }
uint selfHandle() const;
- bool hasImmortalHandles() const {
- return true;
- }
+ QString selfID() const;
+ uint status() const;
+ bool hasImmortalHandles() const;
private Q_SLOTS:
- void getSelfHandle(const Tp::Service::ConnectionAdaptor::GetSelfHandleContextPtr &context);
- void getStatus(const Tp::Service::ConnectionAdaptor::GetStatusContextPtr &context);
- void connect(const Tp::Service::ConnectionAdaptor::ConnectContextPtr &context);
- void getInterfaces(const Tp::Service::ConnectionAdaptor::GetInterfacesContextPtr &context) {
- context->setFinished(interfaces());
- }
-
- void getProtocol(const Tp::Service::ConnectionAdaptor::GetProtocolContextPtr &context) {
- context->setFinished(QLatin1String("whosthere"));
- }
-
- void holdHandles(uint handleType, const Tp::UIntList &handles, const Tp::Service::ConnectionAdaptor::HoldHandlesContextPtr &context) {
- context->setFinished();
- }
-
- void inspectHandles(uint handleType, const Tp::UIntList &handles, const Tp::Service::ConnectionAdaptor::InspectHandlesContextPtr &context);
-
- void listChannels(const Tp::Service::ConnectionAdaptor::ListChannelsContextPtr &context) {
- context->setFinished(mConnection->channelsInfo());
- }
+ void connect(
+ const Tp::Service::ConnectionAdaptor::ConnectContextPtr &context);
+ void disconnect(
+ const Tp::Service::ConnectionAdaptor::DisconnectContextPtr &context);
+ void getInterfaces(
+ const Tp::Service::ConnectionAdaptor::GetInterfacesContextPtr &context);
+ void getProtocol(
+ const Tp::Service::ConnectionAdaptor::GetProtocolContextPtr &context);
+ void getSelfHandle(
+ const Tp::Service::ConnectionAdaptor::GetSelfHandleContextPtr &context);
+ void getStatus(
+ const Tp::Service::ConnectionAdaptor::GetStatusContextPtr &context);
+ void holdHandles(uint handleType, const Tp::UIntList &handles,
+ const Tp::Service::ConnectionAdaptor::HoldHandlesContextPtr &context);
+ void inspectHandles(uint handleType, const Tp::UIntList &handles,
+ const Tp::Service::ConnectionAdaptor::InspectHandlesContextPtr &context);
+ void listChannels(
+ const Tp::Service::ConnectionAdaptor::ListChannelsContextPtr &context);
+
+ void requestChannel(const QString &type, uint handleType, uint handle, bool suppressHandler,
+ const Tp::Service::ConnectionAdaptor::RequestChannelContextPtr &context);
+ void releaseHandles(uint handleType, const Tp::UIntList &handles,
+ const Tp::Service::ConnectionAdaptor::ReleaseHandlesContextPtr &context);
+ void requestHandles(uint handleType, const QStringList &identifiers,
+ const Tp::Service::ConnectionAdaptor::RequestHandlesContextPtr &context);
- void disconnect(const Tp::Service::ConnectionAdaptor::DisconnectContextPtr &context);
-
- //void releaseHandles(uint handleType, const Tp::UIntList &handles, const Tp::Service::ConnectionAdaptor::ReleaseHandlesContextPtr &context);
- void requestChannel(const QString &type, uint handleType, uint handle, bool suppressHandler, const Tp::Service::ConnectionAdaptor::RequestChannelContextPtr &context);
- void requestHandles(uint handleType, const QStringList &identifiers, const Tp::Service::ConnectionAdaptor::RequestHandlesContextPtr &context);
//void addClientInterest(const QStringList &tokens, const Tp::Service::ConnectionAdaptor::AddClientInterestContextPtr &context);
//void removeClientInterest(const QStringList &tokens, const Tp::Service::ConnectionAdaptor::RemoveClientInterestContextPtr &context);
-public:
- BaseConnection *mConnection;
- Service::ConnectionAdaptor *mAdaptor;
-
Q_SIGNALS:
void selfHandleChanged(uint selfHandle);
void newChannel(const QDBusObjectPath &objectPath, const QString &channelType, uint handleType, uint handle, bool suppressHandler);
+
+ void selfContactChanged(uint selfHandle, const QString &selfID);
void connectionError(const QString &error, const QVariantMap &details);
void statusChanged(uint status, uint reason);
+
+private:
+ BaseConnection *mConnection;
+ Service::ConnectionAdaptor *mAdaptor;
};
class TP_QT_NO_EXPORT BaseConnectionRequestsInterface::Adaptee : public QObject
@@ -100,7 +100,7 @@ class TP_QT_NO_EXPORT BaseConnectionRequestsInterface::Adaptee : public QObject
public:
Adaptee(BaseConnectionRequestsInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
Tp::ChannelDetailsList channels() const;
Tp::RequestableChannelClassList requestableChannelClasses() const {
debug() << "BaseConnectionRequestsInterface::requestableChannelClasses";
@@ -125,12 +125,14 @@ class TP_QT_NO_EXPORT BaseConnectionContactsInterface::Adaptee : public QObject
Q_PROPERTY(QStringList contactAttributeInterfaces READ contactAttributeInterfaces)
public:
Adaptee(BaseConnectionContactsInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
QStringList contactAttributeInterfaces() const;
private Q_SLOTS:
void getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, bool hold,
const Tp::Service::ConnectionInterfaceContactsAdaptor::GetContactAttributesContextPtr &context);
+ void getContactByID(const QString &identifier, const QStringList &interfaces,
+ const Tp::Service::ConnectionInterfaceContactsAdaptor::GetContactByIDContextPtr &context);
public:
BaseConnectionContactsInterface *mInterface;
};
@@ -143,7 +145,7 @@ class TP_QT_NO_EXPORT BaseConnectionSimplePresenceInterface::Adaptee : public QO
Q_PROPERTY(uint maximumStatusMessageLength READ maximumStatusMessageLength)
public:
Adaptee(BaseConnectionSimplePresenceInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
Tp::SimpleStatusSpecMap statuses() const;
int maximumStatusMessageLength() const;
@@ -167,39 +169,117 @@ class TP_QT_NO_EXPORT BaseConnectionContactListInterface::Adaptee : public QObje
Q_PROPERTY(bool canChangeContactList READ canChangeContactList)
Q_PROPERTY(bool requestUsesMessage READ requestUsesMessage)
Q_PROPERTY(bool downloadAtConnection READ downloadAtConnection)
+
public:
Adaptee(BaseConnectionContactListInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
uint contactListState() const;
bool contactListPersists() const;
bool canChangeContactList() const;
bool requestUsesMessage() const;
bool downloadAtConnection() const;
+
private Q_SLOTS:
- void getContactListAttributes(const QStringList &interfaces, bool hold, const Tp::Service::ConnectionInterfaceContactListAdaptor::GetContactListAttributesContextPtr &context);
- void requestSubscription(const Tp::UIntList &contacts, const QString &message, const Tp::Service::ConnectionInterfaceContactListAdaptor::RequestSubscriptionContextPtr &context);
- //void authorizePublication(const Tp::UIntList &contacts, const Tp::Service::ConnectionInterfaceContactListAdaptor::AuthorizePublicationContextPtr &context);
- //void removeContacts(const Tp::UIntList &contacts, const Tp::Service::ConnectionInterfaceContactListAdaptor::RemoveContactsContextPtr &context);
- //void unsubscribe(const Tp::UIntList &contacts, const Tp::Service::ConnectionInterfaceContactListAdaptor::UnsubscribeContextPtr &context);
- //void unpublish(const Tp::UIntList &contacts, const Tp::Service::ConnectionInterfaceContactListAdaptor::UnpublishContextPtr &context);
- //void download(const Tp::Service::ConnectionInterfaceContactListAdaptor::DownloadContextPtr &context);
+ void getContactListAttributes(const QStringList &interfaces, bool hold,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::GetContactListAttributesContextPtr &context);
+ void requestSubscription(const Tp::UIntList &contacts, const QString &message,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::RequestSubscriptionContextPtr &context);
+ void authorizePublication(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::AuthorizePublicationContextPtr &context);
+ void removeContacts(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::RemoveContactsContextPtr &context);
+ void unsubscribe(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::UnsubscribeContextPtr &context);
+ void unpublish(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::UnpublishContextPtr &context);
+ void download(
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::DownloadContextPtr &context);
+
Q_SIGNALS:
void contactListStateChanged(uint contactListState);
void contactsChangedWithID(const Tp::ContactSubscriptionMap &changes, const Tp::HandleIdentifierMap &identifiers, const Tp::HandleIdentifierMap &removals);
- void contactsChanged(const Tp::ContactSubscriptionMap &changes, const Tp::UIntList &removals);
-public:
+private:
BaseConnectionContactListInterface *mInterface;
};
+class TP_QT_NO_EXPORT BaseConnectionContactGroupsInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool disjointGroups READ disjointGroups)
+ Q_PROPERTY(uint groupStorage READ groupStorage)
+ Q_PROPERTY(QStringList groups READ groups)
+
+public:
+ Adaptee(BaseConnectionContactGroupsInterface *interface);
+ ~Adaptee() override;
+
+ bool disjointGroups() const;
+ uint groupStorage() const;
+ QStringList groups() const;
+
+private Q_SLOTS:
+ void setContactGroups(uint contact, const QStringList &groups,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::SetContactGroupsContextPtr &context);
+ void setGroupMembers(const QString &group, const Tp::UIntList &members,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::SetGroupMembersContextPtr &context);
+ void addToGroup(const QString &group, const Tp::UIntList &members,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::AddToGroupContextPtr &context);
+ void removeFromGroup(const QString &group, const Tp::UIntList &members,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::RemoveFromGroupContextPtr &context);
+ void removeGroup(const QString &group,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::RemoveGroupContextPtr &context);
+ void renameGroup(const QString &oldName, const QString &newName,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::RenameGroupContextPtr &context);
+
+Q_SIGNALS:
+ void groupsChanged(const Tp::UIntList &contact, const QStringList &added, const QStringList &removed);
+ void groupsCreated(const QStringList &names);
+ void groupRenamed(const QString &oldName, const QString &newName);
+ void groupsRemoved(const QStringList &names);
+
+private:
+ BaseConnectionContactGroupsInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseConnectionContactInfoInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(uint contactInfoFlags READ contactInfoFlags)
+ Q_PROPERTY(Tp::FieldSpecs supportedFields READ supportedFields)
+
+public:
+ Adaptee(BaseConnectionContactInfoInterface *interface);
+ ~Adaptee() override;
+
+ uint contactInfoFlags() const;
+ Tp::FieldSpecs supportedFields() const;
+
+private Q_SLOTS:
+ void getContactInfo(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactInfoAdaptor::GetContactInfoContextPtr &context);
+ void refreshContactInfo(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactInfoAdaptor::RefreshContactInfoContextPtr &context);
+ void requestContactInfo(uint contact,
+ const Tp::Service::ConnectionInterfaceContactInfoAdaptor::RequestContactInfoContextPtr &context);
+ void setContactInfo(const Tp::ContactInfoFieldList &contactInfo,
+ const Tp::Service::ConnectionInterfaceContactInfoAdaptor::SetContactInfoContextPtr &context);
+
+signals:
+ void contactInfoChanged(uint contact, const Tp::ContactInfoFieldList &contactInfo);
+
+private:
+ BaseConnectionContactInfoInterface *mInterface;
+};
+
class TP_QT_NO_EXPORT BaseConnectionAddressingInterface::Adaptee : public QObject
{
Q_OBJECT
public:
Adaptee(BaseConnectionAddressingInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
private Q_SLOTS:
@@ -211,4 +291,114 @@ public:
BaseConnectionAddressingInterface *mInterface;
};
+class TP_QT_NO_EXPORT BaseConnectionAliasingInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+
+public:
+ Adaptee(BaseConnectionAliasingInterface *interface);
+ ~Adaptee() override;
+
+private Q_SLOTS:
+ void getAliasFlags(
+ const Tp::Service::ConnectionInterfaceAliasingAdaptor::GetAliasFlagsContextPtr &context);
+ void requestAliases(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceAliasingAdaptor::RequestAliasesContextPtr &context);
+ void getAliases(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceAliasingAdaptor::GetAliasesContextPtr &context);
+ void setAliases(const Tp::AliasMap &aliases,
+ const Tp::Service::ConnectionInterfaceAliasingAdaptor::SetAliasesContextPtr &context);
+
+Q_SIGNALS:
+ void aliasesChanged(const Tp::AliasPairList &aliases);
+
+private:
+ BaseConnectionAliasingInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseConnectionAvatarsInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList supportedAvatarMimeTypes READ supportedAvatarMimeTypes)
+ Q_PROPERTY(uint minimumAvatarHeight READ minimumAvatarHeight)
+ Q_PROPERTY(uint minimumAvatarWidth READ minimumAvatarWidth)
+ Q_PROPERTY(uint recommendedAvatarHeight READ recommendedAvatarHeight)
+ Q_PROPERTY(uint recommendedAvatarWidth READ recommendedAvatarWidth)
+ Q_PROPERTY(uint maximumAvatarHeight READ maximumAvatarHeight)
+ Q_PROPERTY(uint maximumAvatarWidth READ maximumAvatarWidth)
+ Q_PROPERTY(uint maximumAvatarBytes READ maximumAvatarBytes)
+
+public:
+ Adaptee(BaseConnectionAvatarsInterface *interface);
+ ~Adaptee() override;
+
+ QStringList supportedAvatarMimeTypes() const;
+ uint minimumAvatarHeight() const;
+ uint minimumAvatarWidth() const;
+ uint recommendedAvatarHeight() const;
+ uint recommendedAvatarWidth() const;
+ uint maximumAvatarHeight() const;
+ uint maximumAvatarWidth() const;
+ uint maximumAvatarBytes() const;
+
+private Q_SLOTS:
+ void getKnownAvatarTokens(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceAvatarsAdaptor::GetKnownAvatarTokensContextPtr &context);
+ void requestAvatars(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceAvatarsAdaptor::RequestAvatarsContextPtr &context);
+ void setAvatar(const QByteArray &avatar, const QString &mimeType,
+ const Tp::Service::ConnectionInterfaceAvatarsAdaptor::SetAvatarContextPtr &context);
+ void clearAvatar(
+ const Tp::Service::ConnectionInterfaceAvatarsAdaptor::ClearAvatarContextPtr &context);
+
+Q_SIGNALS:
+ void avatarUpdated(uint contact, const QString &newAvatarToken);
+ void avatarRetrieved(uint contact, const QString &token, const QByteArray &avatar, const QString &type);
+
+private:
+ BaseConnectionAvatarsInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseConnectionClientTypesInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+
+public:
+ Adaptee(BaseConnectionClientTypesInterface *interface);
+ ~Adaptee() override;
+
+private Q_SLOTS:
+ void getClientTypes(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceClientTypesAdaptor::GetClientTypesContextPtr &context);
+ void requestClientTypes(uint contact,
+ const Tp::Service::ConnectionInterfaceClientTypesAdaptor::RequestClientTypesContextPtr &context);
+
+Q_SIGNALS:
+ void clientTypesUpdated(uint contact, const QStringList &clientTypes);
+
+private:
+ BaseConnectionClientTypesInterface *mInterface;
+};
+
+class TP_QT_NO_EXPORT BaseConnectionContactCapabilitiesInterface::Adaptee : public QObject
+{
+ Q_OBJECT
+
+public:
+ Adaptee(BaseConnectionContactCapabilitiesInterface *interface);
+ ~Adaptee() override;
+
+private Q_SLOTS:
+ void updateCapabilities(const Tp::HandlerCapabilitiesList &handlerCapabilities,
+ const Tp::Service::ConnectionInterfaceContactCapabilitiesAdaptor::UpdateCapabilitiesContextPtr &context);
+ void getContactCapabilities(const Tp::UIntList &handles,
+ const Tp::Service::ConnectionInterfaceContactCapabilitiesAdaptor::GetContactCapabilitiesContextPtr &context);
+
+Q_SIGNALS:
+ void contactCapabilitiesChanged(const Tp::ContactCapabilitiesMap &caps);
+
+private:
+ BaseConnectionContactCapabilitiesInterface *mInterface;
+};
+
}
diff --git a/TelepathyQt/base-connection-manager-internal.h b/TelepathyQt/base-connection-manager-internal.h
index 538accd9..03025ce2 100644
--- a/TelepathyQt/base-connection-manager-internal.h
+++ b/TelepathyQt/base-connection-manager-internal.h
@@ -42,7 +42,7 @@ class TP_QT_NO_EXPORT BaseConnectionManager::Adaptee : public QObject
public:
Adaptee(const QDBusConnection &dbusConnection, BaseConnectionManager *cm);
- ~Adaptee();
+ ~Adaptee() override;
QStringList interfaces() const;
Tp::ProtocolPropertiesMap protocols() const;
diff --git a/TelepathyQt/base-connection-manager.h b/TelepathyQt/base-connection-manager.h
index e7b1efb3..e11e034f 100644
--- a/TelepathyQt/base-connection-manager.h
+++ b/TelepathyQt/base-connection-manager.h
@@ -68,18 +68,18 @@ public:
dbusConnection, name));
}
- virtual ~BaseConnectionManager();
+ ~BaseConnectionManager() override;
QString name() const;
- QVariantMap immutableProperties() const;
+ QVariantMap immutableProperties() const override;
QList<BaseProtocolPtr> protocols() const;
BaseProtocolPtr protocol(const QString &protocolName) const;
bool hasProtocol(const QString &protocolName) const;
bool addProtocol(const BaseProtocolPtr &protocol);
- bool registerObject(DBusError *error = NULL);
+ bool registerObject(DBusError *error = nullptr);
QList<BaseConnectionPtr> connections() const;
@@ -89,8 +89,8 @@ Q_SIGNALS:
protected:
BaseConnectionManager(const QDBusConnection &dbusConnection, const QString &name);
- virtual bool registerObject(const QString &busName, const QString &objectPath,
- DBusError *error);
+ bool registerObject(const QString &busName, const QString &objectPath,
+ DBusError *error) override;
private Q_SLOTS:
TP_QT_NO_EXPORT void removeConnection();
@@ -100,8 +100,8 @@ private:
class Adaptee;
friend class Adaptee;
- class Private;
- friend class Private;
+ struct Private;
+ friend struct Private;
Private *mPriv;
};
diff --git a/TelepathyQt/base-connection.cpp b/TelepathyQt/base-connection.cpp
index 870e23fd..af6334f9 100644
--- a/TelepathyQt/base-connection.cpp
+++ b/TelepathyQt/base-connection.cpp
@@ -29,7 +29,6 @@
#include "TelepathyQt/debug-internal.h"
#include <TelepathyQt/BaseChannel>
-#include <TelepathyQt/Constants>
#include <TelepathyQt/DBusObject>
#include <TelepathyQt/Utils>
#include <TelepathyQt/AbstractProtocolInterface>
@@ -40,30 +39,32 @@ namespace Tp
{
struct TP_QT_NO_EXPORT BaseConnection::Private {
- Private(BaseConnection *parent, const QDBusConnection &dbusConnection,
+ Private(BaseConnection *connection, const QDBusConnection &dbusConnection,
const QString &cmName, const QString &protocolName,
const QVariantMap &parameters)
- : parent(parent),
+ : connection(connection),
cmName(cmName),
protocolName(protocolName),
parameters(parameters),
- status(Tp::ConnectionStatusDisconnected),
selfHandle(0),
- adaptee(new BaseConnection::Adaptee(dbusConnection, parent)) {
+ status(Tp::ConnectionStatusDisconnected),
+ adaptee(new BaseConnection::Adaptee(dbusConnection, connection))
+ {
}
- BaseConnection *parent;
+ BaseConnection *connection;
QString cmName;
QString protocolName;
QVariantMap parameters;
- uint status;
QHash<QString, AbstractConnectionInterfacePtr> interfaces;
QSet<BaseChannelPtr> channels;
+ uint selfHandle;
+ QString selfID;
+ uint status;
CreateChannelCallback createChannelCB;
- RequestHandlesCallback requestHandlesCB;
ConnectCallback connectCB;
InspectHandlesCallback inspectHandlesCB;
- uint selfHandle;
+ RequestHandlesCallback requestHandlesCB;
BaseConnection::Adaptee *adaptee;
};
@@ -79,28 +80,36 @@ BaseConnection::Adaptee::~Adaptee()
{
}
-void BaseConnection::Adaptee::disconnect(const Tp::Service::ConnectionAdaptor::DisconnectContextPtr &context)
+QStringList BaseConnection::Adaptee::interfaces() const
{
- debug() << "BaseConnection::Adaptee::disconnect";
- /* This will remove the connection from the connection manager
- * and destroy this object. */
- emit mConnection->disconnected();
- context->setFinished();
+ QStringList ret;
+ foreach(const AbstractConnectionInterfacePtr &iface, mConnection->interfaces()) {
+ ret << iface->interfaceName();
+ }
+ return ret;
}
-void BaseConnection::Adaptee::getSelfHandle(const Tp::Service::ConnectionAdaptor::GetSelfHandleContextPtr &context)
+uint BaseConnection::Adaptee::selfHandle() const
{
- context->setFinished(mConnection->mPriv->selfHandle);
+ return mConnection->selfHandle();
}
-uint BaseConnection::Adaptee::selfHandle() const
+QString BaseConnection::Adaptee::selfID() const
{
- return mConnection->mPriv->selfHandle;
+ return mConnection->selfID();
}
-void BaseConnection::Adaptee::getStatus(const Tp::Service::ConnectionAdaptor::GetStatusContextPtr &context)
+uint BaseConnection::Adaptee::status() const
{
- context->setFinished(mConnection->status());
+ return mConnection->status();
+}
+
+bool BaseConnection::Adaptee::hasImmortalHandles() const
+{
+ /* True if handles last for the whole lifetime of the Connection.
+ * This SHOULD be the case in all connection managers, but connection managers
+ * MUST interoperate with older clients (which reference-count handles). */
+ return true;
}
void BaseConnection::Adaptee::connect(const Tp::Service::ConnectionAdaptor::ConnectContextPtr &context)
@@ -118,29 +127,66 @@ void BaseConnection::Adaptee::connect(const Tp::Service::ConnectionAdaptor::Conn
context->setFinished();
}
+void BaseConnection::Adaptee::disconnect(const Tp::Service::ConnectionAdaptor::DisconnectContextPtr &context)
+{
+ debug() << "BaseConnection::Adaptee::disconnect";
+
+ foreach(const BaseChannelPtr &channel, mConnection->mPriv->channels) {
+ /* BaseChannel::closed() signal triggers removeChannel() method call with proper cleanup */
+ channel->close();
+ }
+
+ /* This signal will remove the connection from the connection manager
+ * and destroy this object. */
+ emit mConnection->disconnected();
+
+ context->setFinished();
+}
+
+void BaseConnection::Adaptee::getInterfaces(const Service::ConnectionAdaptor::GetInterfacesContextPtr &context)
+{
+ context->setFinished(interfaces());
+}
+
+void BaseConnection::Adaptee::getProtocol(const Service::ConnectionAdaptor::GetProtocolContextPtr &context)
+{
+ context->setFinished(mConnection->protocolName());
+}
+
+void BaseConnection::Adaptee::getSelfHandle(const Service::ConnectionAdaptor::GetSelfHandleContextPtr &context)
+{
+ context->setFinished(mConnection->selfHandle());
+}
+
+void BaseConnection::Adaptee::getStatus(const Tp::Service::ConnectionAdaptor::GetStatusContextPtr &context)
+{
+ context->setFinished(mConnection->status());
+}
+
+void BaseConnection::Adaptee::holdHandles(uint handleType, const UIntList &handles, const Service::ConnectionAdaptor::HoldHandlesContextPtr &context)
+{
+ // This method no does anything since 0.21.6
+ Q_UNUSED(handleType)
+ Q_UNUSED(handles)
+ context->setFinished();
+}
+
void BaseConnection::Adaptee::inspectHandles(uint handleType,
const Tp::UIntList &handles,
const Tp::Service::ConnectionAdaptor::InspectHandlesContextPtr &context)
{
- if (!mConnection->mPriv->inspectHandlesCB.isValid()) {
- context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
- return;
- }
DBusError error;
- QStringList ret = mConnection->mPriv->inspectHandlesCB(handleType, handles, &error);
+ QStringList identifiers = mConnection->inspectHandles(handleType, handles, &error);
if (error.isValid()) {
context->setFinishedWithError(error.name(), error.message());
return;
}
- context->setFinished(ret);
+ context->setFinished(identifiers);
}
-QStringList BaseConnection::Adaptee::interfaces() const
+
+void BaseConnection::Adaptee::listChannels(const Service::ConnectionAdaptor::ListChannelsContextPtr &context)
{
- QStringList ret;
- foreach(const AbstractConnectionInterfacePtr & iface, mConnection->interfaces()) {
- ret << iface->interfaceName();
- }
- return ret;
+ context->setFinished(mConnection->channelsInfo());
}
void BaseConnection::Adaptee::requestChannel(const QString &type, uint handleType, uint handle, bool suppressHandler,
@@ -148,14 +194,14 @@ void BaseConnection::Adaptee::requestChannel(const QString &type, uint handleTyp
{
debug() << "BaseConnection::Adaptee::requestChannel (deprecated)";
DBusError error;
+
+ QVariantMap request;
+ request[TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType")] = type;
+ request[TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType")] = handleType;
+ request[TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle")] = handle;
+
bool yours;
- BaseChannelPtr channel = mConnection->ensureChannel(type,
- handleType,
- handle,
- yours,
- selfHandle(),
- suppressHandler,
- &error);
+ BaseChannelPtr channel = mConnection->ensureChannel(request, yours, suppressHandler, &error);
if (error.isValid() || !channel) {
context->setFinishedWithError(error.name(), error.message());
return;
@@ -163,6 +209,14 @@ void BaseConnection::Adaptee::requestChannel(const QString &type, uint handleTyp
context->setFinished(QDBusObjectPath(channel->objectPath()));
}
+void BaseConnection::Adaptee::releaseHandles(uint handleType, const UIntList &handles, const Service::ConnectionAdaptor::ReleaseHandlesContextPtr &context)
+{
+ // This method no does anything since 0.21.6
+ Q_UNUSED(handleType)
+ Q_UNUSED(handles)
+ context->setFinished();
+}
+
void BaseConnection::Adaptee::requestHandles(uint handleType, const QStringList &identifiers,
const Tp::Service::ConnectionAdaptor::RequestHandlesContextPtr &context)
{
@@ -204,6 +258,10 @@ BaseConnection::BaseConnection(const QDBusConnection &dbusConnection,
*/
BaseConnection::~BaseConnection()
{
+ foreach (BaseChannelPtr channel, mPriv->channels) {
+ channel->close();
+ }
+
delete mPriv;
}
@@ -247,18 +305,54 @@ QVariantMap BaseConnection::parameters() const
*/
QVariantMap BaseConnection::immutableProperties() const
{
- // FIXME
+ // There is no immutable properties.
return QVariantMap();
}
-/**
- * Return a unique name for this connection.
- *
- * \return A unique name for this connection.
- */
-QString BaseConnection::uniqueName() const
+uint BaseConnection::selfHandle() const
+{
+ return mPriv->selfHandle;
+}
+
+void BaseConnection::setSelfHandle(uint selfHandle)
+{
+ if (selfHandle == mPriv->selfHandle) {
+ return;
+ }
+
+ mPriv->selfHandle = selfHandle;
+ QMetaObject::invokeMethod(mPriv->adaptee, "selfHandleChanged", Q_ARG(uint, mPriv->selfHandle)); //Can simply use emit in Qt5
+ QMetaObject::invokeMethod(mPriv->adaptee, "selfContactChanged", Q_ARG(uint, mPriv->selfHandle), Q_ARG(QString, mPriv->selfID)); //Can simply use emit in Qt5
+}
+
+QString BaseConnection::selfID() const
{
- return QString(QLatin1String("_%1")).arg((quintptr) this, 0, 16);
+ return mPriv->selfID;
+}
+
+void BaseConnection::setSelfID(const QString &selfID)
+{
+ if (selfID == mPriv->selfID) {
+ return;
+ }
+
+ mPriv->selfID = selfID;
+ QMetaObject::invokeMethod(mPriv->adaptee, "selfContactChanged", Q_ARG(uint, mPriv->selfHandle), Q_ARG(QString, mPriv->selfID)); //Can simply use emit in Qt5
+}
+
+void BaseConnection::setSelfContact(uint selfHandle, const QString &selfID)
+{
+ if ((selfHandle == mPriv->selfHandle) && (selfID == mPriv->selfID)) {
+ return;
+ }
+
+ if (selfHandle != mPriv->selfHandle) {
+ QMetaObject::invokeMethod(mPriv->adaptee, "selfHandleChanged", Q_ARG(uint, mPriv->selfHandle)); //Can simply use emit in Qt5
+ mPriv->selfHandle = selfHandle;
+ }
+
+ mPriv->selfID = selfID;
+ QMetaObject::invokeMethod(mPriv->adaptee, "selfContactChanged", Q_ARG(uint, mPriv->selfHandle), Q_ARG(QString, mPriv->selfID)); //Can simply use emit in Qt5
}
uint BaseConnection::status() const
@@ -281,12 +375,7 @@ void BaseConnection::setCreateChannelCallback(const CreateChannelCallback &cb)
mPriv->createChannelCB = cb;
}
-Tp::BaseChannelPtr BaseConnection::createChannel(const QString &channelType,
- uint targetHandleType,
- uint targetHandle,
- uint initiatorHandle,
- bool suppressHandler,
- DBusError *error)
+Tp::BaseChannelPtr BaseConnection::createChannel(const QVariantMap &request, bool suppressHandler, DBusError *error)
{
if (!mPriv->createChannelCB.isValid()) {
error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
@@ -297,67 +386,75 @@ Tp::BaseChannelPtr BaseConnection::createChannel(const QString &channelType,
return BaseChannelPtr();
}
- BaseChannelPtr channel = mPriv->createChannelCB(channelType, targetHandleType, targetHandle, error);
+ if (request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".Requested"))) {
+ error->set(TP_QT_ERROR_INVALID_ARGUMENT, QString(QLatin1String("The %1.Requested property must not be presented in the request details.")).arg(TP_QT_IFACE_CHANNEL));
+ return BaseChannelPtr();
+ }
+
+ QVariantMap requestDetails = request;
+ requestDetails[TP_QT_IFACE_CHANNEL + QLatin1String(".Requested")] = suppressHandler;
+
+ BaseChannelPtr channel = mPriv->createChannelCB(requestDetails, error);
if (error->isValid())
return BaseChannelPtr();
- QString targetID;
- if (targetHandle != 0) {
- QStringList list = mPriv->inspectHandlesCB(targetHandleType, UIntList() << targetHandle, error);
+ QString targetID = channel->targetID();
+ if ((channel->targetHandle() != 0) && targetID.isEmpty()) {
+ QStringList list = mPriv->inspectHandlesCB(channel->targetHandleType(), UIntList() << channel->targetHandle(), error);
if (error->isValid()) {
- debug() << "BaseConnection::createChannel: could not resolve handle " << targetHandle;
+ debug() << "BaseConnection::createChannel: could not resolve handle " << channel->targetHandle();
return BaseChannelPtr();
} else {
debug() << "BaseConnection::createChannel: found targetID " << *list.begin();
targetID = *list.begin();
}
+ channel->setTargetID(targetID);
}
- QString initiatorID;
- if (initiatorHandle != 0) {
- QStringList list = mPriv->inspectHandlesCB(HandleTypeContact, UIntList() << initiatorHandle, error);
+
+ if (request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".InitiatorHandle"))) {
+ channel->setInitiatorHandle(request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".InitiatorHandle")).toUInt());
+ }
+
+ QString initiatorID = channel->initiatorID();
+ if ((channel->initiatorHandle() != 0) && initiatorID.isEmpty()) {
+ QStringList list = mPriv->inspectHandlesCB(HandleTypeContact, UIntList() << channel->initiatorHandle(), error);
if (error->isValid()) {
- debug() << "BaseConnection::createChannel: could not resolve handle " << initiatorHandle;
+ debug() << "BaseConnection::createChannel: could not resolve handle " << channel->initiatorHandle();
return BaseChannelPtr();
} else {
debug() << "BaseConnection::createChannel: found initiatorID " << *list.begin();
initiatorID = *list.begin();
}
+ channel->setInitiatorID(initiatorID);
}
- channel->setInitiatorHandle(initiatorHandle);
- channel->setInitiatorID(initiatorID);
- channel->setTargetID(targetID);
- channel->setRequested(initiatorHandle == mPriv->selfHandle);
+ channel->setRequested(suppressHandler);
channel->registerObject(error);
if (error->isValid())
return BaseChannelPtr();
- mPriv->channels.insert(channel);
-
- BaseConnectionRequestsInterfacePtr reqIface =
- BaseConnectionRequestsInterfacePtr::dynamicCast(interface(TP_QT_IFACE_CONNECTION_INTERFACE_REQUESTS));
-
- if (!reqIface.isNull())
- //emit after return
- QMetaObject::invokeMethod(reqIface.data(), "newChannels",
- Qt::QueuedConnection,
- Q_ARG(Tp::ChannelDetailsList, ChannelDetailsList() << channel->details()));
+ addChannel(channel, suppressHandler);
+ return channel;
+}
- //emit after return
- QMetaObject::invokeMethod(mPriv->adaptee, "newChannel",
- Qt::QueuedConnection,
- Q_ARG(QDBusObjectPath, QDBusObjectPath(channel->objectPath())),
- Q_ARG(QString, channel->channelType()),
- Q_ARG(uint, channel->targetHandleType()),
- Q_ARG(uint, channel->targetHandle()),
- Q_ARG(bool, suppressHandler));
+void BaseConnection::setConnectCallback(const ConnectCallback &cb)
+{
+ mPriv->connectCB = cb;
+}
- QObject::connect(channel.data(),
- SIGNAL(closed()),
- SLOT(removeChannel()));
+void BaseConnection::setInspectHandlesCallback(const InspectHandlesCallback &cb)
+{
+ mPriv->inspectHandlesCB = cb;
+}
- return channel;
+QStringList BaseConnection::inspectHandles(uint handleType, const Tp::UIntList &handles, DBusError *error)
+{
+ if (!mPriv->inspectHandlesCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return QStringList();
+ }
+ return mPriv->inspectHandlesCB(handleType, handles, error);
}
void BaseConnection::setRequestHandlesCallback(const RequestHandlesCallback &cb)
@@ -365,18 +462,18 @@ void BaseConnection::setRequestHandlesCallback(const RequestHandlesCallback &cb)
mPriv->requestHandlesCB = cb;
}
-UIntList BaseConnection::requestHandles(uint handleType, const QStringList &identifiers, DBusError* error)
+Tp::UIntList BaseConnection::requestHandles(uint handleType, const QStringList &identifiers, DBusError *error)
{
if (!mPriv->requestHandlesCB.isValid()) {
error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
- return UIntList();
+ return Tp::UIntList();
}
return mPriv->requestHandlesCB(handleType, identifiers, error);
}
Tp::ChannelInfoList BaseConnection::channelsInfo()
{
- qDebug() << "BaseConnection::channelsInfo:";
+ debug() << "BaseConnection::channelsInfo:";
Tp::ChannelInfoList list;
foreach(const BaseChannelPtr & c, mPriv->channels) {
Tp::ChannelInfo info;
@@ -384,7 +481,7 @@ Tp::ChannelInfoList BaseConnection::channelsInfo()
info.channelType = c->channelType();
info.handle = c->targetHandle();
info.handleType = c->targetHandleType();
- qDebug() << "BaseConnection::channelsInfo " << info.channel.path();
+ debug() << "BaseConnection::channelsInfo " << info.channel.path();
list << info;
}
return list;
@@ -398,21 +495,113 @@ Tp::ChannelDetailsList BaseConnection::channelsDetails()
return list;
}
-BaseChannelPtr BaseConnection::ensureChannel(const QString &channelType, uint targetHandleType,
- uint targetHandle, bool &yours, uint initiatorHandle,
- bool suppressHandler,
- DBusError* error)
+/**
+ * \fn Tp::BaseChannelPtr BaseConnection::getExistingChannel(const QVariantMap &request, DBusError *error)
+ *
+ * Returns an existing channel satisfying the given \a request or a null pointer if such a channel does not exist.
+ *
+ * This method iterates over the existing channels and calls matchChannel() to find the one satisfying the \a request.
+ *
+ * If \a error is passed, any error that may occur will be stored there.
+ *
+ * \param request A dictionary containing the desirable properties.
+ * \param error A pointer to an empty DBusError where any possible error will be stored.
+ * \return A pointer to a channel satisfying the given \a request or a null pointer.
+ * \sa matchChannel()
+ */
+Tp::BaseChannelPtr BaseConnection::getExistingChannel(const QVariantMap &request, DBusError *error)
{
- foreach(BaseChannelPtr channel, mPriv->channels) {
- if (channel->channelType() == channelType
- && channel->targetHandleType() == targetHandleType
- && channel->targetHandle() == targetHandle) {
- yours = false;
+ if (!request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"))) {
+ error->set(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("Missing parameters"));
+ return Tp::BaseChannelPtr();
+ }
+
+ const QString channelType = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType")).toString();
+
+ foreach(const BaseChannelPtr &channel, mPriv->channels) {
+ if (channel->channelType() != channelType) {
+ continue;
+ }
+
+ bool match = matchChannel(channel, request, error);
+
+ if (error->isValid()) {
+ return BaseChannelPtr();
+ }
+
+ if (match) {
return channel;
}
}
+
+ return Tp::BaseChannelPtr();
+}
+
+/**
+ * \fn Tp::BaseChannelPtr BaseConnection::ensureChannel(const QVariantMap &request, bool &yours, bool suppressHandler, DBusError *error)
+ *
+ * Returns a new or existing channel satisfying the given \a request.
+ *
+ * This method uses getExistingChannel() to find one satisfying the \a request. If there is no
+ * suitable channel, then a new channel with the given request details will be created.
+ *
+ * If \a error is passed, any error that may occur will be stored there.
+ *
+ * \param request A dictionary containing the desirable properties.
+ * \param yours A returning argument. \c true if returned channel is a new one and \c false otherwise.
+ * \param suppressHandler An option to suppress handler in case of a new channel creation.
+ * \param error A pointer to an empty DBusError where any possible error will be stored.
+ * \return A pointer to a channel satisfying the given \a request.
+ * \sa getExistingChannel()
+ */
+Tp::BaseChannelPtr BaseConnection::ensureChannel(const QVariantMap &request, bool &yours, bool suppressHandler, DBusError *error)
+{
+ if (!request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"))) {
+ error->set(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("Missing parameters"));
+ return Tp::BaseChannelPtr();
+ }
+
+ Tp::BaseChannelPtr existingChannel = getExistingChannel(request, error);
+ if (existingChannel) {
+ yours = false;
+ return existingChannel;
+ }
+
yours = true;
- return createChannel(channelType, targetHandleType, targetHandle, initiatorHandle, suppressHandler, error);
+ return createChannel(request, suppressHandler, error);
+}
+
+void BaseConnection::addChannel(BaseChannelPtr channel, bool suppressHandler)
+{
+ if (mPriv->channels.contains(channel)) {
+ warning() << "BaseConnection::addChannel: Channel already added.";
+ return;
+ }
+
+ mPriv->channels.insert(channel);
+
+ BaseConnectionRequestsInterfacePtr reqIface =
+ BaseConnectionRequestsInterfacePtr::dynamicCast(interface(TP_QT_IFACE_CONNECTION_INTERFACE_REQUESTS));
+
+ if (!reqIface.isNull()) {
+ //emit after return
+ QMetaObject::invokeMethod(reqIface.data(), "newChannels",
+ Qt::QueuedConnection,
+ Q_ARG(Tp::ChannelDetailsList, ChannelDetailsList() << channel->details()));
+ }
+
+ //emit after return
+ QMetaObject::invokeMethod(mPriv->adaptee, "newChannel",
+ Qt::QueuedConnection,
+ Q_ARG(QDBusObjectPath, QDBusObjectPath(channel->objectPath())),
+ Q_ARG(QString, channel->channelType()),
+ Q_ARG(uint, channel->targetHandleType()),
+ Q_ARG(uint, channel->targetHandle()),
+ Q_ARG(bool, suppressHandler));
+
+ QObject::connect(channel.data(),
+ SIGNAL(closed()),
+ SLOT(removeChannel()));
}
void BaseConnection::removeChannel()
@@ -421,6 +610,14 @@ void BaseConnection::removeChannel()
qobject_cast<BaseChannel*>(sender()));
Q_ASSERT(channel);
Q_ASSERT(mPriv->channels.contains(channel));
+
+ BaseConnectionRequestsInterfacePtr reqIface =
+ BaseConnectionRequestsInterfacePtr::dynamicCast(interface(TP_QT_IFACE_CONNECTION_INTERFACE_REQUESTS));
+
+ if (!reqIface.isNull()) {
+ reqIface->channelClosed(QDBusObjectPath(channel->objectPath()));
+ }
+
mPriv->channels.remove(channel);
}
@@ -487,6 +684,7 @@ bool BaseConnection::plugInterface(const AbstractConnectionInterfacePtr &interfa
debug() << "Interface" << interface->interfaceName() << "plugged";
mPriv->interfaces.insert(interface->interfaceName(), interface);
+ interface->setBaseConnection(this);
return true;
}
@@ -544,6 +742,16 @@ bool BaseConnection::registerObject(DBusError *error)
}
/**
+ * Return a unique name for this connection.
+ *
+ * \return A unique name for this connection.
+ */
+QString BaseConnection::uniqueName() const
+{
+ return QString(QLatin1String("connection_%1")).arg((quintptr) this, 0, 16);
+}
+
+/**
* Reimplemented from DBusService.
*/
bool BaseConnection::registerObject(const QString &busName,
@@ -552,24 +760,47 @@ bool BaseConnection::registerObject(const QString &busName,
return DBusService::registerObject(busName, objectPath, error);
}
-void BaseConnection::setSelfHandle(uint selfHandle)
-{
- mPriv->selfHandle = selfHandle;
-}
-
-uint BaseConnection::selfHandle() const
+/**
+ * \fn bool BaseConnection::matchChannel(const BaseChannelPtr &channel, const QVariantMap &request, DBusError *error)
+ *
+ * Check \a channel on conformity with \a request.
+ *
+ * This virtual method is used to check if a \a channel satisfying the given request.
+ * It is warranted, that the type of the channel meets the requested type.
+ *
+ * The default implementation compares TargetHandleType and TargetHandle/TargetID.
+ * If \a error is passed, any error that may occur will be stored there.
+ *
+ * \param channel A pointer to a channel to be checked.
+ * \param request A dictionary containing the desirable properties.
+ * \param error A pointer to an empty DBusError where any
+ * possible error will be stored.
+ * \return \c true if channel match the request and \c false otherwise.
+ * \sa ensureChannel()
+ */
+bool BaseConnection::matchChannel(const BaseChannelPtr &channel, const QVariantMap &request, DBusError *error)
{
- return mPriv->selfHandle;
-}
+ Q_UNUSED(error);
-void BaseConnection::setConnectCallback(const ConnectCallback &cb)
-{
- mPriv->connectCB = cb;
-}
+ if (request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType"))) {
+ uint targetHandleType = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType")).toUInt();
+ if (channel->targetHandleType() != targetHandleType) {
+ return false;
+ }
+ if (request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle"))) {
+ uint targetHandle = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle")).toUInt();
+ return channel->targetHandle() == targetHandle;
+ } else if (request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetID"))) {
+ const QString targetID = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetID")).toString();
+ return channel->targetID() == targetID;
+ } else {
+ // Request is not valid
+ return false;
+ }
+ }
-void BaseConnection::setInspectHandlesCallback(const InspectHandlesCallback &cb)
-{
- mPriv->inspectHandlesCB = cb;
+ // Unknown request
+ return false;
}
/**
@@ -580,7 +811,7 @@ void BaseConnection::setInspectHandlesCallback(const InspectHandlesCallback &cb)
/**
* \class AbstractConnectionInterface
- * \ingroup servicecm
+ * \ingroup serviceconn
* \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
*
* \brief Base class for all the Connection object interface implementations.
@@ -595,6 +826,11 @@ AbstractConnectionInterface::~AbstractConnectionInterface()
{
}
+void AbstractConnectionInterface::setBaseConnection(BaseConnection *connection)
+{
+ Q_UNUSED(connection)
+}
+
// Conn.I.Requests
BaseConnectionRequestsInterface::Adaptee::Adaptee(BaseConnectionRequestsInterface *interface)
: QObject(interface),
@@ -647,7 +883,7 @@ struct TP_QT_NO_EXPORT BaseConnectionRequestsInterface::Private {
/**
* \class BaseConnectionRequestsInterface
- * \ingroup servicecm
+ * \ingroup serviceconn
* \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
*
* \brief Base class for implementations of Connection.Interface.Requests
@@ -702,38 +938,16 @@ void BaseConnectionRequestsInterface::newChannels(const Tp::ChannelDetailsList &
QMetaObject::invokeMethod(mPriv->adaptee,"newChannels", Q_ARG(Tp::ChannelDetailsList,channels)); //Can replace by a direct call in Qt5
}
+void BaseConnectionRequestsInterface::channelClosed(const QDBusObjectPath &removed)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee,"channelClosed", Q_ARG(QDBusObjectPath, removed)); //Can replace by a direct call in Qt5
+}
+
void BaseConnectionRequestsInterface::ensureChannel(const QVariantMap &request, bool &yours,
QDBusObjectPath &objectPath, QVariantMap &details, DBusError *error)
{
- if (!request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"))
- || !request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType"))
- || (!request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle"))
- && !request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetID")))) {
- error->set(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("Missing parameters"));
- return;
- }
-
- QString channelType = request[TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType")].toString();
- uint targetHandleType = request[TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType")].toUInt();
- uint targetHandle;
- if (request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle")))
- targetHandle = request[TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle")].toUInt();
- else {
- QString targetID = request[TP_QT_IFACE_CHANNEL + QLatin1String(".TargetID")].toString();
- Tp::UIntList list = mPriv->connection->requestHandles(targetHandleType, QStringList() << targetID, error);
- if (error->isValid()) {
- warning() << "BBaseConnectionRequestsInterface::ensureChannel: could not resolve ID " << targetID;
- return;
- }
- targetHandle = *list.begin();
- }
+ BaseChannelPtr channel = mPriv->connection->ensureChannel(request, yours, /* suppressHandler */ true, error);
- bool suppressHandler = true;
- BaseChannelPtr channel = mPriv->connection->ensureChannel(channelType, targetHandleType,
- targetHandle, yours,
- mPriv->connection->selfHandle(),
- suppressHandler,
- error);
if (error->isValid())
return;
@@ -745,23 +959,13 @@ void BaseConnectionRequestsInterface::createChannel(const QVariantMap &request,
QDBusObjectPath &objectPath,
QVariantMap &details, DBusError *error)
{
- if (!request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"))
- || !request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"))
- || !request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"))) {
+ if (!request.contains(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"))) {
error->set(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("Missing parameters"));
return;
}
- QString channelType = request[TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType")].toString();
- uint targetHandleType = request[TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType")].toUInt();
- uint targetHandle = request[TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle")].toUInt();
+ BaseChannelPtr channel = mPriv->connection->createChannel(request, /* suppressHandler */ true, error);
- bool suppressHandler = true;
- BaseChannelPtr channel = mPriv->connection->createChannel(channelType, targetHandleType,
- targetHandle,
- mPriv->connection->selfHandle(),
- suppressHandler,
- error);
if (error->isValid())
return;
@@ -769,8 +973,21 @@ void BaseConnectionRequestsInterface::createChannel(const QVariantMap &request,
details = channel->details().properties;
}
-
// Conn.I.Contacts
+// The BaseConnectionContactsInterface code is fully or partially generated by the TelepathyQt-Generator.
+struct TP_QT_NO_EXPORT BaseConnectionContactsInterface::Private {
+ Private(BaseConnectionContactsInterface *parent)
+ : connection(nullptr),
+ adaptee(new BaseConnectionContactsInterface::Adaptee(parent))
+ {
+ }
+
+ QStringList contactAttributeInterfaces;
+ GetContactAttributesCallback getContactAttributesCB;
+ BaseConnection *connection;
+ BaseConnectionContactsInterface::Adaptee *adaptee;
+};
+
BaseConnectionContactsInterface::Adaptee::Adaptee(BaseConnectionContactsInterface *interface)
: QObject(interface),
mInterface(interface)
@@ -781,36 +998,42 @@ BaseConnectionContactsInterface::Adaptee::~Adaptee()
{
}
-void BaseConnectionContactsInterface::Adaptee::getContactAttributes(const Tp::UIntList &handles,
- const QStringList &interfaces, bool /*hold*/,
+QStringList BaseConnectionContactsInterface::Adaptee::contactAttributeInterfaces() const
+{
+ return mInterface->contactAttributeInterfaces();
+}
+
+void BaseConnectionContactsInterface::Adaptee::getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, bool /* hold */,
const Tp::Service::ConnectionInterfaceContactsAdaptor::GetContactAttributesContextPtr &context)
{
DBusError error;
- ContactAttributesMap contactAttributes = mInterface->getContactAttributes(handles, interfaces, &error);
+ Tp::ContactAttributesMap attributes = mInterface->getContactAttributes(handles, interfaces, &error);
if (error.isValid()) {
context->setFinishedWithError(error.name(), error.message());
return;
}
- context->setFinished(contactAttributes);
+ context->setFinished(attributes);
}
-struct TP_QT_NO_EXPORT BaseConnectionContactsInterface::Private {
- Private(BaseConnectionContactsInterface *parent)
- : adaptee(new BaseConnectionContactsInterface::Adaptee(parent)) {
- }
- QStringList contactAttributeInterfaces;
- GetContactAttributesCallback getContactAttributesCallback;
- BaseConnectionContactsInterface::Adaptee *adaptee;
-};
-
-QStringList BaseConnectionContactsInterface::Adaptee::contactAttributeInterfaces() const
+void BaseConnectionContactsInterface::Adaptee::getContactByID(const QString &identifier, const QStringList &interfaces,
+ const Tp::Service::ConnectionInterfaceContactsAdaptor::GetContactByIDContextPtr &context)
{
- return mInterface->mPriv->contactAttributeInterfaces;
+ debug() << "BaseConnectionContactsInterface::Adaptee::getContactByID";
+ DBusError error;
+ uint handle;
+ QVariantMap attributes;
+
+ mInterface->getContactByID(identifier, interfaces, handle, attributes, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(handle, attributes);
}
/**
* \class BaseConnectionContactsInterface
- * \ingroup servicecm
+ * \ingroup serviceconn
* \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
*
* \brief Base class for implementations of Connection.Interface.Contacts
@@ -833,8 +1056,13 @@ BaseConnectionContactsInterface::~BaseConnectionContactsInterface()
delete mPriv;
}
+void BaseConnectionContactsInterface::setBaseConnection(BaseConnection *connection)
+{
+ mPriv->connection = connection;
+}
+
/**
- * Return the immutable properties of this<interface.
+ * Return the immutable properties of this interface.
*
* Immutable properties cannot change after the interface has been registered
* on a service on the bus with registerInterface().
@@ -849,10 +1077,9 @@ QVariantMap BaseConnectionContactsInterface::immutableProperties() const
return map;
}
-void BaseConnectionContactsInterface::createAdaptor()
+QStringList BaseConnectionContactsInterface::contactAttributeInterfaces() const
{
- (void) new Service::ConnectionInterfaceContactsAdaptor(dbusObject()->dbusConnection(),
- mPriv->adaptee, dbusObject());
+ return mPriv->contactAttributeInterfaces;
}
void BaseConnectionContactsInterface::setContactAttributeInterfaces(const QStringList &contactAttributeInterfaces)
@@ -860,20 +1087,43 @@ void BaseConnectionContactsInterface::setContactAttributeInterfaces(const QStrin
mPriv->contactAttributeInterfaces = contactAttributeInterfaces;
}
+void BaseConnectionContactsInterface::createAdaptor()
+{
+ (void) new Tp::Service::ConnectionInterfaceContactsAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
void BaseConnectionContactsInterface::setGetContactAttributesCallback(const GetContactAttributesCallback &cb)
{
- mPriv->getContactAttributesCallback = cb;
+ mPriv->getContactAttributesCB = cb;
}
-ContactAttributesMap BaseConnectionContactsInterface::getContactAttributes(const Tp::UIntList &handles,
- const QStringList &interfaces,
- DBusError *error)
+Tp::ContactAttributesMap BaseConnectionContactsInterface::getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, DBusError *error)
{
- if (!mPriv->getContactAttributesCallback.isValid()) {
+ if (!mPriv->getContactAttributesCB.isValid()) {
error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
- return ContactAttributesMap();
+ return Tp::ContactAttributesMap();
+ }
+ return mPriv->getContactAttributesCB(handles, interfaces, error);
+}
+
+void BaseConnectionContactsInterface::getContactByID(const QString &identifier, const QStringList &interfaces, uint &handle, QVariantMap &attributes, DBusError *error)
+{
+ const Tp::UIntList handles = mPriv->connection->requestHandles(Tp::HandleTypeContact, QStringList() << identifier, error);
+ if (error->isValid() || handles.isEmpty()) {
+ // The check for empty handles is paranoid, because the error must be set in such case.
+ error->set(TP_QT_ERROR_INVALID_HANDLE, QLatin1String("Could not process ID"));
+ return;
+ }
+
+ const Tp::ContactAttributesMap result = getContactAttributes(handles, interfaces, error);
+
+ if (error->isValid()) {
+ return;
}
- return mPriv->getContactAttributesCallback(handles, interfaces, error);
+
+ handle = handles.first();
+ attributes = result.value(handle);
}
// Conn.I.SimplePresence
@@ -889,12 +1139,12 @@ BaseConnectionSimplePresenceInterface::Adaptee::~Adaptee()
struct TP_QT_NO_EXPORT BaseConnectionSimplePresenceInterface::Private {
Private(BaseConnectionSimplePresenceInterface *parent)
- : maxmimumStatusMessageLength(0),
+ : maximumStatusMessageLength(0),
adaptee(new BaseConnectionSimplePresenceInterface::Adaptee(parent)) {
}
SetPresenceCallback setPresenceCB;
SimpleStatusSpecMap statuses;
- uint maxmimumStatusMessageLength;
+ uint maximumStatusMessageLength;
/* The current presences */
SimpleContactPresences presences;
BaseConnectionSimplePresenceInterface::Adaptee *adaptee;
@@ -902,7 +1152,7 @@ struct TP_QT_NO_EXPORT BaseConnectionSimplePresenceInterface::Private {
/**
* \class BaseConnectionSimplePresenceInterface
- * \ingroup servicecm
+ * \ingroup serviceconn
* \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
*
* \brief Base class for implementations of Connection.Interface.SimplePresence
@@ -925,21 +1175,6 @@ BaseConnectionSimplePresenceInterface::~BaseConnectionSimplePresenceInterface()
delete mPriv;
}
-/**
- * Return the immutable properties of this<interface.
- *
- * Immutable properties cannot change after the interface has been registered
- * on a service on the bus with registerInterface().
- *
- * \return The immutable properties of this interface.
- */
-QVariantMap BaseConnectionSimplePresenceInterface::immutableProperties() const
-{
- QVariantMap map;
- //FIXME
- return map;
-}
-
void BaseConnectionSimplePresenceInterface::createAdaptor()
{
(void) new Service::ConnectionInterfaceSimplePresenceAdaptor(dbusObject()->dbusConnection(),
@@ -950,10 +1185,19 @@ void BaseConnectionSimplePresenceInterface::createAdaptor()
void BaseConnectionSimplePresenceInterface::setPresences(const Tp::SimpleContactPresences &presences)
{
+ Tp::SimpleContactPresences newPresences;
+
foreach(uint handle, presences.keys()) {
+ if (mPriv->presences.contains(handle) && mPriv->presences.value(handle) == presences.value(handle)) {
+ continue;
+ }
mPriv->presences[handle] = presences[handle];
+ newPresences[handle] = presences[handle];
+ }
+
+ if (!newPresences.isEmpty()) {
+ QMetaObject::invokeMethod(mPriv->adaptee, "presencesChanged", Q_ARG(Tp::SimpleContactPresences, newPresences)); //Can simply use emit in Qt5
}
- QMetaObject::invokeMethod(mPriv->adaptee, "presencesChanged", Q_ARG(Tp::SimpleContactPresences, presences)); //Can simply use emit in Qt5
}
void BaseConnectionSimplePresenceInterface::setSetPresenceCallback(const SetPresenceCallback &cb)
@@ -961,16 +1205,36 @@ void BaseConnectionSimplePresenceInterface::setSetPresenceCallback(const SetPres
mPriv->setPresenceCB = cb;
}
+SimpleContactPresences BaseConnectionSimplePresenceInterface::getPresences(const UIntList &contacts)
+{
+ Tp::SimpleContactPresences presences;
+ foreach(uint handle, contacts) {
+ static const Tp::SimplePresence unknownPresence = { /* type */ ConnectionPresenceTypeUnknown, /* status */ QLatin1String("unknown") };
+ presences[handle] = mPriv->presences.value(handle, unknownPresence);
+ }
+
+ return presences;
+}
+
+Tp::SimpleStatusSpecMap BaseConnectionSimplePresenceInterface::statuses() const
+{
+ return mPriv->statuses;
+}
+
void BaseConnectionSimplePresenceInterface::setStatuses(const SimpleStatusSpecMap &statuses)
{
mPriv->statuses = statuses;
}
-void BaseConnectionSimplePresenceInterface::setMaxmimumStatusMessageLength(uint maxmimumStatusMessageLength)
+uint BaseConnectionSimplePresenceInterface::maximumStatusMessageLength() const
{
- mPriv->maxmimumStatusMessageLength = maxmimumStatusMessageLength;
+ return mPriv->maximumStatusMessageLength;
}
+void BaseConnectionSimplePresenceInterface::setMaximumStatusMessageLength(uint maximumStatusMessageLength)
+{
+ mPriv->maximumStatusMessageLength = maximumStatusMessageLength;
+}
Tp::SimpleStatusSpecMap BaseConnectionSimplePresenceInterface::Adaptee::statuses() const
{
@@ -979,7 +1243,7 @@ Tp::SimpleStatusSpecMap BaseConnectionSimplePresenceInterface::Adaptee::statuses
int BaseConnectionSimplePresenceInterface::Adaptee::maximumStatusMessageLength() const
{
- return mInterface->mPriv->maxmimumStatusMessageLength;
+ return mInterface->mPriv->maximumStatusMessageLength;
}
void BaseConnectionSimplePresenceInterface::Adaptee::setPresence(const QString &status, const QString &statusMessage_,
@@ -998,10 +1262,10 @@ void BaseConnectionSimplePresenceInterface::Adaptee::setPresence(const QString &
}
QString statusMessage = statusMessage_;
- if ((uint)statusMessage.length() > mInterface->mPriv->maxmimumStatusMessageLength) {
+ if ((uint)statusMessage.length() > mInterface->mPriv->maximumStatusMessageLength) {
debug() << "BaseConnectionSimplePresenceInterface::Adaptee::setPresence: "
- << "truncating status to " << mInterface->mPriv->maxmimumStatusMessageLength;
- statusMessage = statusMessage.left(mInterface->mPriv->maxmimumStatusMessageLength);
+ << "truncating status to " << mInterface->mPriv->maximumStatusMessageLength;
+ statusMessage = statusMessage.left(mInterface->mPriv->maximumStatusMessageLength);
}
DBusError error;
@@ -1029,31 +1293,10 @@ void BaseConnectionSimplePresenceInterface::Adaptee::setPresence(const QString &
void BaseConnectionSimplePresenceInterface::Adaptee::getPresences(const Tp::UIntList &contacts,
const Tp::Service::ConnectionInterfaceSimplePresenceAdaptor::GetPresencesContextPtr &context)
{
- Tp::SimpleContactPresences presences;
- foreach(uint handle, contacts) {
- SimpleContactPresences::iterator i = mInterface->mPriv->presences.find(handle);
- if (i == mInterface->mPriv->presences.end()) {
- Tp::SimplePresence presence;
- presence.type = ConnectionPresenceTypeUnknown;
- presence.status = QLatin1String("unknown");
- presences[handle] = presence;
- } else
- presences[handle] = *i;
- }
- context->setFinished(presences);
+ context->setFinished(mInterface->getPresences(contacts));
}
// Conn.I.ContactList
-BaseConnectionContactListInterface::Adaptee::Adaptee(BaseConnectionContactListInterface *interface)
- : QObject(interface),
- mInterface(interface)
-{
-}
-
-BaseConnectionContactListInterface::Adaptee::~Adaptee()
-{
-}
-
struct TP_QT_NO_EXPORT BaseConnectionContactListInterface::Private {
Private(BaseConnectionContactListInterface *parent)
: contactListState(ContactListStateNone),
@@ -1061,8 +1304,10 @@ struct TP_QT_NO_EXPORT BaseConnectionContactListInterface::Private {
canChangeContactList(true),
requestUsesMessage(false),
downloadAtConnection(false),
- adaptee(new BaseConnectionContactListInterface::Adaptee(parent)) {
+ adaptee(new BaseConnectionContactListInterface::Adaptee(parent))
+ {
}
+
uint contactListState;
bool contactListPersists;
bool canChangeContactList;
@@ -1070,12 +1315,143 @@ struct TP_QT_NO_EXPORT BaseConnectionContactListInterface::Private {
bool downloadAtConnection;
GetContactListAttributesCallback getContactListAttributesCB;
RequestSubscriptionCallback requestSubscriptionCB;
+ AuthorizePublicationCallback authorizePublicationCB;
+ RemoveContactsCallback removeContactsCB;
+ UnsubscribeCallback unsubscribeCB;
+ UnpublishCallback unpublishCB;
+ DownloadCallback downloadCB;
BaseConnectionContactListInterface::Adaptee *adaptee;
};
+BaseConnectionContactListInterface::Adaptee::Adaptee(BaseConnectionContactListInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseConnectionContactListInterface::Adaptee::~Adaptee()
+{
+}
+
+uint BaseConnectionContactListInterface::Adaptee::contactListState() const
+{
+ return mInterface->contactListState();
+}
+
+bool BaseConnectionContactListInterface::Adaptee::contactListPersists() const
+{
+ return mInterface->contactListPersists();
+}
+
+bool BaseConnectionContactListInterface::Adaptee::canChangeContactList() const
+{
+ return mInterface->canChangeContactList();
+}
+
+bool BaseConnectionContactListInterface::Adaptee::requestUsesMessage() const
+{
+ return mInterface->requestUsesMessage();
+}
+
+bool BaseConnectionContactListInterface::Adaptee::downloadAtConnection() const
+{
+ return mInterface->downloadAtConnection();
+}
+
+void BaseConnectionContactListInterface::Adaptee::getContactListAttributes(const QStringList &interfaces, bool hold,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::GetContactListAttributesContextPtr &context)
+{
+ debug() << "BaseConnectionContactListInterface::Adaptee::getContactListAttributes";
+ DBusError error;
+ Tp::ContactAttributesMap attributes = mInterface->getContactListAttributes(interfaces, hold, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(attributes);
+}
+
+void BaseConnectionContactListInterface::Adaptee::requestSubscription(const Tp::UIntList &contacts, const QString &message,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::RequestSubscriptionContextPtr &context)
+{
+ debug() << "BaseConnectionContactListInterface::Adaptee::requestSubscription";
+ DBusError error;
+ mInterface->requestSubscription(contacts, message, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionContactListInterface::Adaptee::authorizePublication(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::AuthorizePublicationContextPtr &context)
+{
+ debug() << "BaseConnectionContactListInterface::Adaptee::authorizePublication";
+ DBusError error;
+ mInterface->authorizePublication(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionContactListInterface::Adaptee::removeContacts(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::RemoveContactsContextPtr &context)
+{
+ debug() << "BaseConnectionContactListInterface::Adaptee::removeContacts";
+ DBusError error;
+ mInterface->removeContacts(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionContactListInterface::Adaptee::unsubscribe(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::UnsubscribeContextPtr &context)
+{
+ debug() << "BaseConnectionContactListInterface::Adaptee::unsubscribe";
+ DBusError error;
+ mInterface->unsubscribe(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionContactListInterface::Adaptee::unpublish(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::UnpublishContextPtr &context)
+{
+ debug() << "BaseConnectionContactListInterface::Adaptee::unpublish";
+ DBusError error;
+ mInterface->unpublish(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionContactListInterface::Adaptee::download(
+ const Tp::Service::ConnectionInterfaceContactListAdaptor::DownloadContextPtr &context)
+{
+ debug() << "BaseConnectionContactListInterface::Adaptee::download";
+ DBusError error;
+ mInterface->download(&error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
/**
* \class BaseConnectionContactListInterface
- * \ingroup servicecm
+ * \ingroup serviceconn
* \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
*
* \brief Base class for implementations of Connection.Interface.ContactList
@@ -1098,36 +1474,24 @@ BaseConnectionContactListInterface::~BaseConnectionContactListInterface()
delete mPriv;
}
-/**
- * Return the immutable properties of this<interface.
- *
- * Immutable properties cannot change after the interface has been registered
- * on a service on the bus with registerInterface().
- *
- * \return The immutable properties of this interface.
- */
-QVariantMap BaseConnectionContactListInterface::immutableProperties() const
-{
- QVariantMap map;
- return map;
-}
-
-void BaseConnectionContactListInterface::createAdaptor()
+uint BaseConnectionContactListInterface::contactListState() const
{
- (void) new Service::ConnectionInterfaceContactListAdaptor(dbusObject()->dbusConnection(),
- mPriv->adaptee, dbusObject());
+ return mPriv->contactListState;
}
void BaseConnectionContactListInterface::setContactListState(uint contactListState)
{
- bool changed = (contactListState != mPriv->contactListState);
+ if (mPriv->contactListState == contactListState) {
+ return;
+ }
+
mPriv->contactListState = contactListState;
- if (changed)
- //emit after return
- QMetaObject::invokeMethod(mPriv->adaptee, "contactListStateChanged",
- Qt::QueuedConnection,
- Q_ARG(uint, contactListState));
+ QMetaObject::invokeMethod(mPriv->adaptee, "contactListStateChanged", Q_ARG(uint, contactListState)); //Can simply use emit in Qt5
+}
+bool BaseConnectionContactListInterface::contactListPersists() const
+{
+ return mPriv->contactListPersists;
}
void BaseConnectionContactListInterface::setContactListPersists(bool contactListPersists)
@@ -1135,86 +1499,522 @@ void BaseConnectionContactListInterface::setContactListPersists(bool contactList
mPriv->contactListPersists = contactListPersists;
}
+bool BaseConnectionContactListInterface::canChangeContactList() const
+{
+ return mPriv->canChangeContactList;
+}
+
void BaseConnectionContactListInterface::setCanChangeContactList(bool canChangeContactList)
{
mPriv->canChangeContactList = canChangeContactList;
}
+bool BaseConnectionContactListInterface::requestUsesMessage() const
+{
+ return mPriv->requestUsesMessage;
+}
+
void BaseConnectionContactListInterface::setRequestUsesMessage(bool requestUsesMessage)
{
mPriv->requestUsesMessage = requestUsesMessage;
}
+bool BaseConnectionContactListInterface::downloadAtConnection() const
+{
+ return mPriv->downloadAtConnection;
+}
+
void BaseConnectionContactListInterface::setDownloadAtConnection(bool downloadAtConnection)
{
mPriv->downloadAtConnection = downloadAtConnection;
}
-void BaseConnectionContactListInterface::setGetContactListAttributesCallback(const GetContactListAttributesCallback &cb)
+void BaseConnectionContactListInterface::createAdaptor()
+{
+ (void) new Service::ConnectionInterfaceContactListAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+void BaseConnectionContactListInterface::setGetContactListAttributesCallback(const BaseConnectionContactListInterface::GetContactListAttributesCallback &cb)
{
mPriv->getContactListAttributesCB = cb;
}
-void BaseConnectionContactListInterface::setRequestSubscriptionCallback(const RequestSubscriptionCallback &cb)
+Tp::ContactAttributesMap BaseConnectionContactListInterface::getContactListAttributes(const QStringList &interfaces, bool hold, DBusError *error)
+{
+ if (!mPriv->getContactListAttributesCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return Tp::ContactAttributesMap();
+ }
+ return mPriv->getContactListAttributesCB(interfaces, hold, error);
+}
+
+void BaseConnectionContactListInterface::setRequestSubscriptionCallback(const BaseConnectionContactListInterface::RequestSubscriptionCallback &cb)
{
mPriv->requestSubscriptionCB = cb;
}
+void BaseConnectionContactListInterface::requestSubscription(const Tp::UIntList &contacts, const QString &message, DBusError *error)
+{
+ if (!mPriv->requestSubscriptionCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->requestSubscriptionCB(contacts, message, error);
+}
+
+void BaseConnectionContactListInterface::setAuthorizePublicationCallback(const BaseConnectionContactListInterface::AuthorizePublicationCallback &cb)
+{
+ mPriv->authorizePublicationCB = cb;
+}
+
+void BaseConnectionContactListInterface::authorizePublication(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->authorizePublicationCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->authorizePublicationCB(contacts, error);
+}
+
+void BaseConnectionContactListInterface::setRemoveContactsCallback(const BaseConnectionContactListInterface::RemoveContactsCallback &cb)
+{
+ mPriv->removeContactsCB = cb;
+}
+
+void BaseConnectionContactListInterface::removeContacts(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->removeContactsCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->removeContactsCB(contacts, error);
+}
+
+void BaseConnectionContactListInterface::setUnsubscribeCallback(const BaseConnectionContactListInterface::UnsubscribeCallback &cb)
+{
+ mPriv->unsubscribeCB = cb;
+}
+
+void BaseConnectionContactListInterface::unsubscribe(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->unsubscribeCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->unsubscribeCB(contacts, error);
+}
+
+void BaseConnectionContactListInterface::setUnpublishCallback(const BaseConnectionContactListInterface::UnpublishCallback &cb)
+{
+ mPriv->unpublishCB = cb;
+}
+
+void BaseConnectionContactListInterface::unpublish(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->unpublishCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->unpublishCB(contacts, error);
+}
+
+void BaseConnectionContactListInterface::setDownloadCallback(const BaseConnectionContactListInterface::DownloadCallback &cb)
+{
+ mPriv->downloadCB = cb;
+}
+
+void BaseConnectionContactListInterface::download(DBusError *error)
+{
+ if (!mPriv->downloadCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->downloadCB(error);
+}
+
void BaseConnectionContactListInterface::contactsChangedWithID(const Tp::ContactSubscriptionMap &changes, const Tp::HandleIdentifierMap &identifiers, const Tp::HandleIdentifierMap &removals)
{
- QMetaObject::invokeMethod(mPriv->adaptee,"contactsChangedWithID", Q_ARG(Tp::ContactSubscriptionMap, changes), Q_ARG(Tp::HandleIdentifierMap, identifiers), Q_ARG(Tp::HandleIdentifierMap,removals)); //Can simply use emit in Qt5
+ QMetaObject::invokeMethod(mPriv->adaptee, "contactsChangedWithID", Q_ARG(Tp::ContactSubscriptionMap, changes), Q_ARG(Tp::HandleIdentifierMap, identifiers), Q_ARG(Tp::HandleIdentifierMap, removals)); //Can simply use emit in Qt5
}
-uint BaseConnectionContactListInterface::Adaptee::contactListState() const
+// Conn.I.ContactGroups
+// The BaseConnectionContactGroupsInterface code is fully or partially generated by the TelepathyQt-Generator.
+struct TP_QT_NO_EXPORT BaseConnectionContactGroupsInterface::Private {
+ Private(BaseConnectionContactGroupsInterface *parent)
+ : disjointGroups(false),
+ groupStorage(Tp::ContactMetadataStorageTypeNone),
+ adaptee(new BaseConnectionContactGroupsInterface::Adaptee(parent))
+ {
+ }
+
+ bool disjointGroups;
+ Tp::ContactMetadataStorageType groupStorage;
+ QStringList groups;
+ SetContactGroupsCallback setContactGroupsCB;
+ SetGroupMembersCallback setGroupMembersCB;
+ AddToGroupCallback addToGroupCB;
+ RemoveFromGroupCallback removeFromGroupCB;
+ RemoveGroupCallback removeGroupCB;
+ RenameGroupCallback renameGroupCB;
+ BaseConnectionContactGroupsInterface::Adaptee *adaptee;
+};
+
+BaseConnectionContactGroupsInterface::Adaptee::Adaptee(BaseConnectionContactGroupsInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
{
- return mInterface->mPriv->contactListState;
}
-bool BaseConnectionContactListInterface::Adaptee::contactListPersists() const
+BaseConnectionContactGroupsInterface::Adaptee::~Adaptee()
{
- return mInterface->mPriv->contactListPersists;
}
-bool BaseConnectionContactListInterface::Adaptee::canChangeContactList() const
+bool BaseConnectionContactGroupsInterface::Adaptee::disjointGroups() const
{
- return mInterface->mPriv->canChangeContactList;
+ return mInterface->disjointGroups();
}
-bool BaseConnectionContactListInterface::Adaptee::requestUsesMessage() const
+uint BaseConnectionContactGroupsInterface::Adaptee::groupStorage() const
{
- return mInterface->mPriv->requestUsesMessage;
+ return mInterface->groupStorage();
}
-bool BaseConnectionContactListInterface::Adaptee::downloadAtConnection() const
+QStringList BaseConnectionContactGroupsInterface::Adaptee::groups() const
{
- return mInterface->mPriv->downloadAtConnection;
+ return mInterface->groups();
}
-void BaseConnectionContactListInterface::Adaptee::getContactListAttributes(const QStringList &interfaces,
- bool hold, const Tp::Service::ConnectionInterfaceContactListAdaptor::GetContactListAttributesContextPtr &context)
+void BaseConnectionContactGroupsInterface::Adaptee::setContactGroups(uint contact, const QStringList &groups,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::SetContactGroupsContextPtr &context)
{
- if (!mInterface->mPriv->getContactListAttributesCB.isValid()) {
- context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ debug() << "BaseConnectionContactGroupsInterface::Adaptee::setContactGroups";
+ DBusError error;
+ mInterface->setContactGroups(contact, groups, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
return;
}
+ context->setFinished();
+}
+
+void BaseConnectionContactGroupsInterface::Adaptee::setGroupMembers(const QString &group, const Tp::UIntList &members,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::SetGroupMembersContextPtr &context)
+{
+ debug() << "BaseConnectionContactGroupsInterface::Adaptee::setGroupMembers";
DBusError error;
- Tp::ContactAttributesMap contactAttributesMap = mInterface->mPriv->getContactListAttributesCB(interfaces, hold, &error);
+ mInterface->setGroupMembers(group, members, &error);
if (error.isValid()) {
context->setFinishedWithError(error.name(), error.message());
return;
}
- context->setFinished(contactAttributesMap);
+ context->setFinished();
}
-void BaseConnectionContactListInterface::Adaptee::requestSubscription(const Tp::UIntList &contacts,
- const QString &message, const Tp::Service::ConnectionInterfaceContactListAdaptor::RequestSubscriptionContextPtr &context)
+void BaseConnectionContactGroupsInterface::Adaptee::addToGroup(const QString &group, const Tp::UIntList &members,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::AddToGroupContextPtr &context)
{
- if (!mInterface->mPriv->requestSubscriptionCB.isValid()) {
- context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ debug() << "BaseConnectionContactGroupsInterface::Adaptee::addToGroup";
+ DBusError error;
+ mInterface->addToGroup(group, members, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionContactGroupsInterface::Adaptee::removeFromGroup(const QString &group, const Tp::UIntList &members,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::RemoveFromGroupContextPtr &context)
+{
+ debug() << "BaseConnectionContactGroupsInterface::Adaptee::removeFromGroup";
+ DBusError error;
+ mInterface->removeFromGroup(group, members, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionContactGroupsInterface::Adaptee::removeGroup(const QString &group,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::RemoveGroupContextPtr &context)
+{
+ debug() << "BaseConnectionContactGroupsInterface::Adaptee::removeGroup";
+ DBusError error;
+ mInterface->removeGroup(group, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionContactGroupsInterface::Adaptee::renameGroup(const QString &oldName, const QString &newName,
+ const Tp::Service::ConnectionInterfaceContactGroupsAdaptor::RenameGroupContextPtr &context)
+{
+ debug() << "BaseConnectionContactGroupsInterface::Adaptee::renameGroup";
+ DBusError error;
+ mInterface->renameGroup(oldName, newName, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+/**
+ * \class BaseConnectionContactGroupsInterface
+ * \ingroup serviceconn
+ * \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
+ *
+ * \brief Base class for implementations of Connection.Interface.ContactGroups
+ */
+
+/**
+ * Class constructor.
+ */
+BaseConnectionContactGroupsInterface::BaseConnectionContactGroupsInterface()
+ : AbstractConnectionInterface(TP_QT_IFACE_CONNECTION_INTERFACE_CONTACT_GROUPS),
+ mPriv(new Private(this))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseConnectionContactGroupsInterface::~BaseConnectionContactGroupsInterface()
+{
+ delete mPriv;
+}
+
+bool BaseConnectionContactGroupsInterface::disjointGroups() const
+{
+ return mPriv->disjointGroups;
+}
+
+void BaseConnectionContactGroupsInterface::setDisjointGroups(bool disjointGroups)
+{
+ mPriv->disjointGroups = disjointGroups;
+}
+
+Tp::ContactMetadataStorageType BaseConnectionContactGroupsInterface::groupStorage() const
+{
+ return mPriv->groupStorage;
+}
+
+void BaseConnectionContactGroupsInterface::setGroupStorage(Tp::ContactMetadataStorageType groupStorage)
+{
+ mPriv->groupStorage = groupStorage;
+}
+
+QStringList BaseConnectionContactGroupsInterface::groups() const
+{
+ return mPriv->groups;
+}
+
+void BaseConnectionContactGroupsInterface::setGroups(const QStringList &groups)
+{
+ mPriv->groups = groups;
+}
+
+void BaseConnectionContactGroupsInterface::createAdaptor()
+{
+ (void) new Tp::Service::ConnectionInterfaceContactGroupsAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+void BaseConnectionContactGroupsInterface::setSetContactGroupsCallback(const SetContactGroupsCallback &cb)
+{
+ mPriv->setContactGroupsCB = cb;
+}
+
+void BaseConnectionContactGroupsInterface::setContactGroups(uint contact, const QStringList &groups, DBusError *error)
+{
+ if (!mPriv->setContactGroupsCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->setContactGroupsCB(contact, groups, error);
+}
+
+void BaseConnectionContactGroupsInterface::setSetGroupMembersCallback(const SetGroupMembersCallback &cb)
+{
+ mPriv->setGroupMembersCB = cb;
+}
+
+void BaseConnectionContactGroupsInterface::setGroupMembers(const QString &group, const Tp::UIntList &members, DBusError *error)
+{
+ if (!mPriv->setGroupMembersCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->setGroupMembersCB(group, members, error);
+}
+
+void BaseConnectionContactGroupsInterface::setAddToGroupCallback(const AddToGroupCallback &cb)
+{
+ mPriv->addToGroupCB = cb;
+}
+
+void BaseConnectionContactGroupsInterface::addToGroup(const QString &group, const Tp::UIntList &members, DBusError *error)
+{
+ if (!mPriv->addToGroupCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->addToGroupCB(group, members, error);
+}
+
+void BaseConnectionContactGroupsInterface::setRemoveFromGroupCallback(const RemoveFromGroupCallback &cb)
+{
+ mPriv->removeFromGroupCB = cb;
+}
+
+void BaseConnectionContactGroupsInterface::removeFromGroup(const QString &group, const Tp::UIntList &members, DBusError *error)
+{
+ if (!mPriv->removeFromGroupCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->removeFromGroupCB(group, members, error);
+}
+
+void BaseConnectionContactGroupsInterface::setRemoveGroupCallback(const RemoveGroupCallback &cb)
+{
+ mPriv->removeGroupCB = cb;
+}
+
+void BaseConnectionContactGroupsInterface::removeGroup(const QString &group, DBusError *error)
+{
+ if (!mPriv->removeGroupCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->removeGroupCB(group, error);
+}
+
+void BaseConnectionContactGroupsInterface::setRenameGroupCallback(const RenameGroupCallback &cb)
+{
+ mPriv->renameGroupCB = cb;
+}
+
+void BaseConnectionContactGroupsInterface::renameGroup(const QString &oldName, const QString &newName, DBusError *error)
+{
+ if (!mPriv->renameGroupCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
return;
}
+ mPriv->renameGroupCB(oldName, newName, error);
+
+ if (!error->isValid()) {
+ groupRenamed(oldName, newName);
+ groupsCreated(QStringList() << newName);
+ groupsRemoved(QStringList() << oldName);
+ }
+}
+
+void BaseConnectionContactGroupsInterface::groupsCreated(const QStringList &names)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "groupsCreated", Q_ARG(QStringList, names)); //Can simply use emit in Qt5
+}
+
+void BaseConnectionContactGroupsInterface::groupRenamed(const QString &oldName, const QString &newName)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "groupRenamed", Q_ARG(QString, oldName), Q_ARG(QString, newName)); //Can simply use emit in Qt5
+}
+
+void BaseConnectionContactGroupsInterface::groupsRemoved(const QStringList &names)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "groupsRemoved", Q_ARG(QStringList, names)); //Can simply use emit in Qt5
+}
+
+void BaseConnectionContactGroupsInterface::groupsChanged(const Tp::UIntList &contact, const QStringList &added, const QStringList &removed)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "groupsChanged", Q_ARG(Tp::UIntList, contact), Q_ARG(QStringList, added), Q_ARG(QStringList, removed)); //Can simply use emit in Qt5
+}
+
+// Conn.I.ContactInfo
+struct TP_QT_NO_EXPORT BaseConnectionContactInfoInterface::Private {
+ Private(BaseConnectionContactInfoInterface *parent)
+ : adaptee(new BaseConnectionContactInfoInterface::Adaptee(parent))
+ {
+ }
+
+ Tp::ContactInfoFlags contactInfoFlags;
+ Tp::FieldSpecs supportedFields;
+ GetContactInfoCallback getContactInfoCB;
+ RefreshContactInfoCallback refreshContactInfoCB;
+ RequestContactInfoCallback requestContactInfoCB;
+ SetContactInfoCallback setContactInfoCB;
+ BaseConnectionContactInfoInterface::Adaptee *adaptee;
+};
+
+BaseConnectionContactInfoInterface::Adaptee::Adaptee(BaseConnectionContactInfoInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseConnectionContactInfoInterface::Adaptee::~Adaptee()
+{
+}
+
+uint BaseConnectionContactInfoInterface::Adaptee::contactInfoFlags() const
+{
+ return mInterface->contactInfoFlags();
+}
+
+Tp::FieldSpecs BaseConnectionContactInfoInterface::Adaptee::supportedFields() const
+{
+ return mInterface->supportedFields();
+}
+
+void BaseConnectionContactInfoInterface::Adaptee::getContactInfo(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactInfoAdaptor::GetContactInfoContextPtr &context)
+{
+ debug() << "BaseConnectionContactInfoInterface::Adaptee::getContactInfo";
DBusError error;
- mInterface->mPriv->requestSubscriptionCB(contacts, message, &error);
+ Tp::ContactInfoMap contactInfo = mInterface->getContactInfo(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(contactInfo);
+}
+
+void BaseConnectionContactInfoInterface::Adaptee::refreshContactInfo(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceContactInfoAdaptor::RefreshContactInfoContextPtr &context)
+{
+ debug() << "BaseConnectionContactInfoInterface::Adaptee::refreshContactInfo";
+ DBusError error;
+ mInterface->refreshContactInfo(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionContactInfoInterface::Adaptee::requestContactInfo(uint contact,
+ const Tp::Service::ConnectionInterfaceContactInfoAdaptor::RequestContactInfoContextPtr &context)
+{
+ debug() << "BaseConnectionContactInfoInterface::Adaptee::requestContactInfo";
+ DBusError error;
+ Tp::ContactInfoFieldList contactInfo = mInterface->requestContactInfo(contact, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(contactInfo);
+}
+
+void BaseConnectionContactInfoInterface::Adaptee::setContactInfo(const Tp::ContactInfoFieldList &contactInfo,
+ const Tp::Service::ConnectionInterfaceContactInfoAdaptor::SetContactInfoContextPtr &context)
+{
+ debug() << "BaseConnectionContactInfoInterface::Adaptee::setContactInfo";
+ DBusError error;
+ mInterface->setContactInfo(contactInfo, &error);
if (error.isValid()) {
context->setFinishedWithError(error.name(), error.message());
return;
@@ -1222,6 +2022,118 @@ void BaseConnectionContactListInterface::Adaptee::requestSubscription(const Tp::
context->setFinished();
}
+/**
+ * \class BaseConnectionContactInfoInterface
+ * \ingroup serviceconn
+ * \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
+ *
+ * \brief Base class for implementations of Connection.Interface.Contact.Info
+ */
+
+/**
+ * Class constructor.
+ */
+BaseConnectionContactInfoInterface::BaseConnectionContactInfoInterface()
+ : AbstractConnectionInterface(TP_QT_IFACE_CONNECTION_INTERFACE_CONTACT_INFO),
+ mPriv(new Private(this))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseConnectionContactInfoInterface::~BaseConnectionContactInfoInterface()
+{
+ delete mPriv;
+}
+
+Tp::ContactInfoFlags BaseConnectionContactInfoInterface::contactInfoFlags() const
+{
+ return mPriv->contactInfoFlags;
+}
+
+void BaseConnectionContactInfoInterface::setContactInfoFlags(const Tp::ContactInfoFlags &contactInfoFlags)
+{
+ mPriv->contactInfoFlags = contactInfoFlags;
+}
+
+Tp::FieldSpecs BaseConnectionContactInfoInterface::supportedFields() const
+{
+ return mPriv->supportedFields;
+}
+
+void BaseConnectionContactInfoInterface::setSupportedFields(const Tp::FieldSpecs &supportedFields)
+{
+ mPriv->supportedFields = supportedFields;
+}
+
+void BaseConnectionContactInfoInterface::createAdaptor()
+{
+ (void) new Service::ConnectionInterfaceContactInfoAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+void BaseConnectionContactInfoInterface::setGetContactInfoCallback(const BaseConnectionContactInfoInterface::GetContactInfoCallback &cb)
+{
+ mPriv->getContactInfoCB = cb;
+}
+
+Tp::ContactInfoMap BaseConnectionContactInfoInterface::getContactInfo(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->getContactInfoCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return Tp::ContactInfoMap();
+ }
+ return mPriv->getContactInfoCB(contacts, error);
+}
+
+void BaseConnectionContactInfoInterface::setRefreshContactInfoCallback(const BaseConnectionContactInfoInterface::RefreshContactInfoCallback &cb)
+{
+ mPriv->refreshContactInfoCB = cb;
+}
+
+void BaseConnectionContactInfoInterface::refreshContactInfo(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->refreshContactInfoCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->refreshContactInfoCB(contacts, error);
+}
+
+void BaseConnectionContactInfoInterface::setRequestContactInfoCallback(const BaseConnectionContactInfoInterface::RequestContactInfoCallback &cb)
+{
+ mPriv->requestContactInfoCB = cb;
+}
+
+Tp::ContactInfoFieldList BaseConnectionContactInfoInterface::requestContactInfo(uint contact, DBusError *error)
+{
+ if (!mPriv->requestContactInfoCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return Tp::ContactInfoFieldList();
+ }
+ return mPriv->requestContactInfoCB(contact, error);
+}
+
+void BaseConnectionContactInfoInterface::setSetContactInfoCallback(const BaseConnectionContactInfoInterface::SetContactInfoCallback &cb)
+{
+ mPriv->setContactInfoCB = cb;
+}
+
+void BaseConnectionContactInfoInterface::setContactInfo(const Tp::ContactInfoFieldList &contactInfo, DBusError *error)
+{
+ if (!mPriv->setContactInfoCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->setContactInfoCB(contactInfo, error);
+}
+
+void BaseConnectionContactInfoInterface::contactInfoChanged(uint contact, const Tp::ContactInfoFieldList &contactInfo)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "contactInfoChanged", Q_ARG(uint, contact), Q_ARG(Tp::ContactInfoFieldList, contactInfo)); //Can simply use emit in Qt5
+}
+
// Conn.I.Addressing
BaseConnectionAddressingInterface::Adaptee::Adaptee(BaseConnectionAddressingInterface *interface)
: QObject(interface),
@@ -1243,11 +2155,11 @@ struct TP_QT_NO_EXPORT BaseConnectionAddressingInterface::Private {
};
/**
- * \class BaseProtocolPresenceInterface
- * \ingroup servicecm
- * \headerfile TelepathyQt/base-protocol.h <TelepathyQt/BaseProtocolPresenceInterface>
+ * \class BaseConnectionAddressingInterface
+ * \ingroup serviceconn
+ * \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
*
- * \brief Base class for implementations of Protocol.Interface.Presence
+ * \brief Base class for implementations of Connection.Interface.Addressing
*/
/**
@@ -1267,20 +2179,6 @@ BaseConnectionAddressingInterface::~BaseConnectionAddressingInterface()
delete mPriv;
}
-/**
- * Return the immutable properties of this<interface.
- *
- * Immutable properties cannot change after the interface has been registered
- * on a service on the bus with registerInterface().
- *
- * \return The immutable properties of this interface.
- */
-QVariantMap BaseConnectionAddressingInterface::immutableProperties() const
-{
- QVariantMap map;
- return map;
-}
-
void BaseConnectionAddressingInterface::createAdaptor()
{
(void) new Service::ConnectionInterfaceAddressingAdaptor(dbusObject()->dbusConnection(),
@@ -1342,4 +2240,624 @@ void BaseConnectionAddressingInterface::Adaptee::getContactsByURI(const QStringL
context->setFinished(addressingNormalizationMap, contactAttributesMap);
}
+// Conn.I.Aliasing
+struct TP_QT_NO_EXPORT BaseConnectionAliasingInterface::Private {
+ Private(BaseConnectionAliasingInterface *parent)
+ : adaptee(new BaseConnectionAliasingInterface::Adaptee(parent))
+ {
+ }
+
+ GetAliasFlagsCallback getAliasFlagsCB;
+ RequestAliasesCallback requestAliasesCB;
+ GetAliasesCallback getAliasesCB;
+ SetAliasesCallback setAliasesCB;
+ BaseConnectionAliasingInterface::Adaptee *adaptee;
+};
+
+BaseConnectionAliasingInterface::Adaptee::Adaptee(BaseConnectionAliasingInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseConnectionAliasingInterface::Adaptee::~Adaptee()
+{
+}
+
+void BaseConnectionAliasingInterface::Adaptee::getAliasFlags(
+ const Tp::Service::ConnectionInterfaceAliasingAdaptor::GetAliasFlagsContextPtr &context)
+{
+ debug() << "BaseConnectionAliasingInterface::Adaptee::getAliasFlags";
+ DBusError error;
+ Tp::ConnectionAliasFlags aliasFlags = mInterface->getAliasFlags(&error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(aliasFlags);
+}
+
+void BaseConnectionAliasingInterface::Adaptee::requestAliases(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceAliasingAdaptor::RequestAliasesContextPtr &context)
+{
+ debug() << "BaseConnectionAliasingInterface::Adaptee::requestAliases";
+ DBusError error;
+ QStringList aliases = mInterface->requestAliases(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(aliases);
+}
+
+void BaseConnectionAliasingInterface::Adaptee::getAliases(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceAliasingAdaptor::GetAliasesContextPtr &context)
+{
+ debug() << "BaseConnectionAliasingInterface::Adaptee::getAliases";
+ DBusError error;
+ Tp::AliasMap aliases = mInterface->getAliases(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(aliases);
+}
+
+void BaseConnectionAliasingInterface::Adaptee::setAliases(const Tp::AliasMap &aliases,
+ const Tp::Service::ConnectionInterfaceAliasingAdaptor::SetAliasesContextPtr &context)
+{
+ debug() << "BaseConnectionAliasingInterface::Adaptee::setAliases";
+ DBusError error;
+ mInterface->setAliases(aliases, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+/**
+ * \class BaseConnectionAliasingInterface
+ * \ingroup serviceconn
+ * \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
+ *
+ * \brief Base class for implementations of Connection.Interface.Aliasing
+ */
+
+/**
+ * Class constructor.
+ */
+BaseConnectionAliasingInterface::BaseConnectionAliasingInterface()
+ : AbstractConnectionInterface(TP_QT_IFACE_CONNECTION_INTERFACE_ALIASING),
+ mPriv(new Private(this))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseConnectionAliasingInterface::~BaseConnectionAliasingInterface()
+{
+ delete mPriv;
+}
+
+void BaseConnectionAliasingInterface::createAdaptor()
+{
+ (void) new Service::ConnectionInterfaceAliasingAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+void BaseConnectionAliasingInterface::setGetAliasFlagsCallback(const BaseConnectionAliasingInterface::GetAliasFlagsCallback &cb)
+{
+ mPriv->getAliasFlagsCB = cb;
+}
+
+Tp::ConnectionAliasFlags BaseConnectionAliasingInterface::getAliasFlags(DBusError *error)
+{
+ if (!mPriv->getAliasFlagsCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return Tp::ConnectionAliasFlags();
+ }
+ return mPriv->getAliasFlagsCB(error);
+}
+
+void BaseConnectionAliasingInterface::setRequestAliasesCallback(const BaseConnectionAliasingInterface::RequestAliasesCallback &cb)
+{
+ mPriv->requestAliasesCB = cb;
+}
+
+QStringList BaseConnectionAliasingInterface::requestAliases(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->requestAliasesCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return QStringList();
+ }
+ return mPriv->requestAliasesCB(contacts, error);
+}
+
+void BaseConnectionAliasingInterface::setGetAliasesCallback(const BaseConnectionAliasingInterface::GetAliasesCallback &cb)
+{
+ mPriv->getAliasesCB = cb;
+}
+
+Tp::AliasMap BaseConnectionAliasingInterface::getAliases(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->getAliasesCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return Tp::AliasMap();
+ }
+ return mPriv->getAliasesCB(contacts, error);
+}
+
+void BaseConnectionAliasingInterface::setSetAliasesCallback(const BaseConnectionAliasingInterface::SetAliasesCallback &cb)
+{
+ mPriv->setAliasesCB = cb;
+}
+
+void BaseConnectionAliasingInterface::setAliases(const Tp::AliasMap &aliases, DBusError *error)
+{
+ if (!mPriv->setAliasesCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->setAliasesCB(aliases, error);
+}
+
+void BaseConnectionAliasingInterface::aliasesChanged(const Tp::AliasPairList &aliases)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "aliasesChanged", Q_ARG(Tp::AliasPairList, aliases)); //Can simply use emit in Qt5
+}
+
+// Conn.I.Avatars
+struct TP_QT_NO_EXPORT BaseConnectionAvatarsInterface::Private {
+ Private(BaseConnectionAvatarsInterface *parent)
+ : adaptee(new BaseConnectionAvatarsInterface::Adaptee(parent))
+ {
+ }
+
+ AvatarSpec avatarDetails;
+ GetKnownAvatarTokensCallback getKnownAvatarTokensCB;
+ RequestAvatarsCallback requestAvatarsCB;
+ SetAvatarCallback setAvatarCB;
+ ClearAvatarCallback clearAvatarCB;
+ BaseConnectionAvatarsInterface::Adaptee *adaptee;
+
+ friend class BaseConnectionAvatarsInterface::Adaptee;
+};
+
+BaseConnectionAvatarsInterface::Adaptee::Adaptee(BaseConnectionAvatarsInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseConnectionAvatarsInterface::Adaptee::~Adaptee()
+{
+}
+
+QStringList BaseConnectionAvatarsInterface::Adaptee::supportedAvatarMimeTypes() const
+{
+ return mInterface->mPriv->avatarDetails.supportedMimeTypes();
+}
+
+uint BaseConnectionAvatarsInterface::Adaptee::minimumAvatarHeight() const
+{
+ return mInterface->mPriv->avatarDetails.minimumHeight();
+}
+
+uint BaseConnectionAvatarsInterface::Adaptee::minimumAvatarWidth() const
+{
+ return mInterface->mPriv->avatarDetails.minimumWidth();
+}
+
+uint BaseConnectionAvatarsInterface::Adaptee::recommendedAvatarHeight() const
+{
+ return mInterface->mPriv->avatarDetails.recommendedHeight();
+}
+
+uint BaseConnectionAvatarsInterface::Adaptee::recommendedAvatarWidth() const
+{
+ return mInterface->mPriv->avatarDetails.recommendedWidth();
+}
+
+uint BaseConnectionAvatarsInterface::Adaptee::maximumAvatarHeight() const
+{
+ return mInterface->mPriv->avatarDetails.maximumHeight();
+}
+
+uint BaseConnectionAvatarsInterface::Adaptee::maximumAvatarWidth() const
+{
+ return mInterface->mPriv->avatarDetails.maximumWidth();
+}
+
+uint BaseConnectionAvatarsInterface::Adaptee::maximumAvatarBytes() const
+{
+ return mInterface->mPriv->avatarDetails.maximumBytes();
+}
+
+void BaseConnectionAvatarsInterface::Adaptee::getKnownAvatarTokens(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceAvatarsAdaptor::GetKnownAvatarTokensContextPtr &context)
+{
+ debug() << "BaseConnectionAvatarsInterface::Adaptee::getKnownAvatarTokens";
+ DBusError error;
+ Tp::AvatarTokenMap tokens = mInterface->getKnownAvatarTokens(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(tokens);
+}
+
+void BaseConnectionAvatarsInterface::Adaptee::requestAvatars(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceAvatarsAdaptor::RequestAvatarsContextPtr &context)
+{
+ debug() << "BaseConnectionAvatarsInterface::Adaptee::requestAvatars";
+ DBusError error;
+ mInterface->requestAvatars(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionAvatarsInterface::Adaptee::setAvatar(const QByteArray &avatar, const QString &mimeType,
+ const Tp::Service::ConnectionInterfaceAvatarsAdaptor::SetAvatarContextPtr &context)
+{
+ debug() << "BaseConnectionAvatarsInterface::Adaptee::setAvatar";
+ DBusError error;
+ QString token = mInterface->setAvatar(avatar, mimeType, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(token);
+}
+
+void BaseConnectionAvatarsInterface::Adaptee::clearAvatar(
+ const Tp::Service::ConnectionInterfaceAvatarsAdaptor::ClearAvatarContextPtr &context)
+{
+ debug() << "BaseConnectionAvatarsInterface::Adaptee::clearAvatar";
+ DBusError error;
+ mInterface->clearAvatar(&error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+/**
+ * \class BaseConnectionAvatarsInterface
+ * \ingroup serviceconn
+ * \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
+ *
+ * \brief Base class for implementations of Connection.Interface.Avatars
+ */
+
+/**
+ * Class constructor.
+ */
+BaseConnectionAvatarsInterface::BaseConnectionAvatarsInterface()
+ : AbstractConnectionInterface(TP_QT_IFACE_CONNECTION_INTERFACE_AVATARS),
+ mPriv(new Private(this))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseConnectionAvatarsInterface::~BaseConnectionAvatarsInterface()
+{
+ delete mPriv;
+}
+
+AvatarSpec BaseConnectionAvatarsInterface::avatarDetails() const
+{
+ return mPriv->avatarDetails;
+}
+
+void BaseConnectionAvatarsInterface::setAvatarDetails(const AvatarSpec &spec)
+{
+ mPriv->avatarDetails = spec;
+}
+
+void BaseConnectionAvatarsInterface::createAdaptor()
+{
+ (void) new Service::ConnectionInterfaceAvatarsAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+void BaseConnectionAvatarsInterface::setGetKnownAvatarTokensCallback(const BaseConnectionAvatarsInterface::GetKnownAvatarTokensCallback &cb)
+{
+ mPriv->getKnownAvatarTokensCB = cb;
+}
+
+Tp::AvatarTokenMap BaseConnectionAvatarsInterface::getKnownAvatarTokens(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->getKnownAvatarTokensCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return Tp::AvatarTokenMap();
+ }
+ return mPriv->getKnownAvatarTokensCB(contacts, error);
+}
+
+void BaseConnectionAvatarsInterface::setRequestAvatarsCallback(const BaseConnectionAvatarsInterface::RequestAvatarsCallback &cb)
+{
+ mPriv->requestAvatarsCB = cb;
+}
+
+void BaseConnectionAvatarsInterface::requestAvatars(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->requestAvatarsCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->requestAvatarsCB(contacts, error);
+}
+
+void BaseConnectionAvatarsInterface::setSetAvatarCallback(const BaseConnectionAvatarsInterface::SetAvatarCallback &cb)
+{
+ mPriv->setAvatarCB = cb;
+}
+
+QString BaseConnectionAvatarsInterface::setAvatar(const QByteArray &avatar, const QString &mimeType, DBusError *error)
+{
+ if (!mPriv->setAvatarCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return QString();
+ }
+ return mPriv->setAvatarCB(avatar, mimeType, error);
+}
+
+void BaseConnectionAvatarsInterface::setClearAvatarCallback(const BaseConnectionAvatarsInterface::ClearAvatarCallback &cb)
+{
+ mPriv->clearAvatarCB = cb;
+}
+
+void BaseConnectionAvatarsInterface::clearAvatar(DBusError *error)
+{
+ if (!mPriv->clearAvatarCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->clearAvatarCB(error);
+}
+
+void BaseConnectionAvatarsInterface::avatarUpdated(uint contact, const QString &newAvatarToken)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "avatarUpdated", Q_ARG(uint, contact), Q_ARG(QString, newAvatarToken)); //Can simply use emit in Qt5
+}
+
+void BaseConnectionAvatarsInterface::avatarRetrieved(uint contact, const QString &token, const QByteArray &avatar, const QString &type)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "avatarRetrieved", Q_ARG(uint, contact), Q_ARG(QString, token), Q_ARG(QByteArray, avatar), Q_ARG(QString, type)); //Can simply use emit in Qt5
+}
+
+// Conn.I.ClientTypes
+// The BaseConnectionClientTypesInterface code is fully or partially generated by the TelepathyQt-Generator.
+struct TP_QT_NO_EXPORT BaseConnectionClientTypesInterface::Private {
+ Private(BaseConnectionClientTypesInterface *parent)
+ : adaptee(new BaseConnectionClientTypesInterface::Adaptee(parent))
+ {
+ }
+
+ GetClientTypesCallback getClientTypesCB;
+ RequestClientTypesCallback requestClientTypesCB;
+ BaseConnectionClientTypesInterface::Adaptee *adaptee;
+};
+
+BaseConnectionClientTypesInterface::Adaptee::Adaptee(BaseConnectionClientTypesInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseConnectionClientTypesInterface::Adaptee::~Adaptee()
+{
+}
+
+void BaseConnectionClientTypesInterface::Adaptee::getClientTypes(const Tp::UIntList &contacts,
+ const Tp::Service::ConnectionInterfaceClientTypesAdaptor::GetClientTypesContextPtr &context)
+{
+ debug() << "BaseConnectionClientTypesInterface::Adaptee::getClientTypes";
+ DBusError error;
+ Tp::ContactClientTypes clientTypes = mInterface->getClientTypes(contacts, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(clientTypes);
+}
+
+void BaseConnectionClientTypesInterface::Adaptee::requestClientTypes(uint contact,
+ const Tp::Service::ConnectionInterfaceClientTypesAdaptor::RequestClientTypesContextPtr &context)
+{
+ debug() << "BaseConnectionClientTypesInterface::Adaptee::requestClientTypes";
+ DBusError error;
+ QStringList clientTypes = mInterface->requestClientTypes(contact, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(clientTypes);
+}
+
+/**
+ * \class BaseConnectionClientTypesInterface
+ * \ingroup serviceconn
+ * \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
+ *
+ * \brief Base class for implementations of Connection.Interface.ClientTypes
+ */
+
+/**
+ * Class constructor.
+ */
+BaseConnectionClientTypesInterface::BaseConnectionClientTypesInterface()
+ : AbstractConnectionInterface(TP_QT_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES),
+ mPriv(new Private(this))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseConnectionClientTypesInterface::~BaseConnectionClientTypesInterface()
+{
+ delete mPriv;
+}
+
+void BaseConnectionClientTypesInterface::createAdaptor()
+{
+ (void) new Tp::Service::ConnectionInterfaceClientTypesAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+void BaseConnectionClientTypesInterface::setGetClientTypesCallback(const GetClientTypesCallback &cb)
+{
+ mPriv->getClientTypesCB = cb;
+}
+
+Tp::ContactClientTypes BaseConnectionClientTypesInterface::getClientTypes(const Tp::UIntList &contacts, DBusError *error)
+{
+ if (!mPriv->getClientTypesCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return Tp::ContactClientTypes();
+ }
+ return mPriv->getClientTypesCB(contacts, error);
+}
+
+void BaseConnectionClientTypesInterface::setRequestClientTypesCallback(const RequestClientTypesCallback &cb)
+{
+ mPriv->requestClientTypesCB = cb;
+}
+
+QStringList BaseConnectionClientTypesInterface::requestClientTypes(uint contact, DBusError *error)
+{
+ if (!mPriv->requestClientTypesCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return QStringList();
+ }
+ return mPriv->requestClientTypesCB(contact, error);
+}
+
+void BaseConnectionClientTypesInterface::clientTypesUpdated(uint contact, const QStringList &clientTypes)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "clientTypesUpdated", Q_ARG(uint, contact), Q_ARG(QStringList, clientTypes)); //Can simply use emit in Qt5
+}
+
+// Conn.I.ContactCapabilities
+// The BaseConnectionContactCapabilitiesInterface code is fully or partially generated by the TelepathyQt-Generator.
+struct TP_QT_NO_EXPORT BaseConnectionContactCapabilitiesInterface::Private {
+ Private(BaseConnectionContactCapabilitiesInterface *parent)
+ : adaptee(new BaseConnectionContactCapabilitiesInterface::Adaptee(parent))
+ {
+ }
+
+ UpdateCapabilitiesCallback updateCapabilitiesCB;
+ GetContactCapabilitiesCallback getContactCapabilitiesCB;
+ BaseConnectionContactCapabilitiesInterface::Adaptee *adaptee;
+};
+
+BaseConnectionContactCapabilitiesInterface::Adaptee::Adaptee(BaseConnectionContactCapabilitiesInterface *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+}
+
+BaseConnectionContactCapabilitiesInterface::Adaptee::~Adaptee()
+{
+}
+
+void BaseConnectionContactCapabilitiesInterface::Adaptee::updateCapabilities(const Tp::HandlerCapabilitiesList &handlerCapabilities,
+ const Tp::Service::ConnectionInterfaceContactCapabilitiesAdaptor::UpdateCapabilitiesContextPtr &context)
+{
+ debug() << "BaseConnectionContactCapabilitiesInterface::Adaptee::updateCapabilities";
+ DBusError error;
+ mInterface->updateCapabilities(handlerCapabilities, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished();
+}
+
+void BaseConnectionContactCapabilitiesInterface::Adaptee::getContactCapabilities(const Tp::UIntList &handles,
+ const Tp::Service::ConnectionInterfaceContactCapabilitiesAdaptor::GetContactCapabilitiesContextPtr &context)
+{
+ debug() << "BaseConnectionContactCapabilitiesInterface::Adaptee::getContactCapabilities";
+ DBusError error;
+ Tp::ContactCapabilitiesMap contactCapabilities = mInterface->getContactCapabilities(handles, &error);
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(contactCapabilities);
+}
+
+/**
+ * \class BaseConnectionContactCapabilitiesInterface
+ * \ingroup serviceconn
+ * \headerfile TelepathyQt/base-connection.h <TelepathyQt/BaseConnection>
+ *
+ * \brief Base class for implementations of Connection.Interface.ContactCapabilities
+ */
+
+/**
+ * Class constructor.
+ */
+BaseConnectionContactCapabilitiesInterface::BaseConnectionContactCapabilitiesInterface()
+ : AbstractConnectionInterface(TP_QT_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES),
+ mPriv(new Private(this))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseConnectionContactCapabilitiesInterface::~BaseConnectionContactCapabilitiesInterface()
+{
+ delete mPriv;
+}
+
+void BaseConnectionContactCapabilitiesInterface::createAdaptor()
+{
+ (void) new Tp::Service::ConnectionInterfaceContactCapabilitiesAdaptor(dbusObject()->dbusConnection(),
+ mPriv->adaptee, dbusObject());
+}
+
+void BaseConnectionContactCapabilitiesInterface::setUpdateCapabilitiesCallback(const UpdateCapabilitiesCallback &cb)
+{
+ mPriv->updateCapabilitiesCB = cb;
+}
+
+void BaseConnectionContactCapabilitiesInterface::updateCapabilities(const Tp::HandlerCapabilitiesList &handlerCapabilities, DBusError *error)
+{
+ if (!mPriv->updateCapabilitiesCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return;
+ }
+ return mPriv->updateCapabilitiesCB(handlerCapabilities, error);
+}
+
+void BaseConnectionContactCapabilitiesInterface::setGetContactCapabilitiesCallback(const GetContactCapabilitiesCallback &cb)
+{
+ mPriv->getContactCapabilitiesCB = cb;
+}
+
+Tp::ContactCapabilitiesMap BaseConnectionContactCapabilitiesInterface::getContactCapabilities(const Tp::UIntList &handles, DBusError *error)
+{
+ if (!mPriv->getContactCapabilitiesCB.isValid()) {
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return Tp::ContactCapabilitiesMap();
+ }
+ return mPriv->getContactCapabilitiesCB(handles, error);
+}
+
+void BaseConnectionContactCapabilitiesInterface::contactCapabilitiesChanged(const Tp::ContactCapabilitiesMap &caps)
+{
+ QMetaObject::invokeMethod(mPriv->adaptee, "contactCapabilitiesChanged", Q_ARG(Tp::ContactCapabilitiesMap, caps)); //Can simply use emit in Qt5
+}
+
}
diff --git a/TelepathyQt/base-connection.h b/TelepathyQt/base-connection.h
index 3667cd06..b359f878 100644
--- a/TelepathyQt/base-connection.h
+++ b/TelepathyQt/base-connection.h
@@ -27,10 +27,12 @@
#error IN_TP_QT_HEADER
#endif
+#include <TelepathyQt/AvatarSpec>
#include <TelepathyQt/DBusService>
#include <TelepathyQt/Global>
#include <TelepathyQt/Types>
#include <TelepathyQt/Callbacks>
+#include <TelepathyQt/Constants>
#include <QDBusConnection>
@@ -46,73 +48,68 @@ class TP_QT_EXPORT BaseConnection : public DBusService
public:
static BaseConnectionPtr create(const QString &cmName, const QString &protocolName,
- const QVariantMap &parameters) {
- return BaseConnectionPtr(new BaseConnection(
- QDBusConnection::sessionBus(), cmName, protocolName, parameters));
- }
- template<typename BaseConnectionSubclass>
- static SharedPtr<BaseConnectionSubclass> create(const QString &cmName,
- const QString &protocolName, const QVariantMap &parameters) {
- return SharedPtr<BaseConnectionSubclass>(new BaseConnectionSubclass(
- QDBusConnection::sessionBus(), cmName, protocolName, parameters));
- }
- static BaseConnectionPtr create(const QDBusConnection &dbusConnection,
- const QString &cmName, const QString &protocolName,
- const QVariantMap &parameters) {
+ const QVariantMap &parameters,
+ const QDBusConnection &dbusConnection = QDBusConnection::sessionBus())
+ {
return BaseConnectionPtr(new BaseConnection(
dbusConnection, cmName, protocolName, parameters));
}
template<typename BaseConnectionSubclass>
- static SharedPtr<BaseConnectionSubclass> create(const QDBusConnection &dbusConnection,
- const QString &cmName, const QString &protocolName,
- const QVariantMap &parameters) {
+ static SharedPtr<BaseConnectionSubclass> create(const QString &cmName,
+ const QString &protocolName, const QVariantMap &parameters,
+ const QDBusConnection &dbusConnection = QDBusConnection::sessionBus())
+ {
return SharedPtr<BaseConnectionSubclass>(new BaseConnectionSubclass(
dbusConnection, cmName, protocolName, parameters));
}
- virtual ~BaseConnection();
+ ~BaseConnection() override;
QString cmName() const;
QString protocolName() const;
QVariantMap parameters() const;
- uint status() const;
- QVariantMap immutableProperties() const;
+ QVariantMap immutableProperties() const override;
- void setStatus(uint newStatus, uint reason);
+ uint selfHandle() const;
+ void setSelfHandle(uint selfHandle);
- typedef Callback4<BaseChannelPtr, const QString&, uint, uint, DBusError*> CreateChannelCallback;
- void setCreateChannelCallback(const CreateChannelCallback &cb);
- Tp::BaseChannelPtr createChannel(const QString &channelType, uint targetHandleType, uint targetHandle, uint initiatorHandle, bool suppressHandler, DBusError *error);
+ QString selfID() const;
+ void setSelfID(const QString &selfID);
- typedef Callback3<UIntList, uint, const QStringList&, DBusError*> RequestHandlesCallback;
- void setRequestHandlesCallback(const RequestHandlesCallback &cb);
- UIntList requestHandles(uint handleType, const QStringList &identifiers, DBusError* error);
+ void setSelfContact(uint selfHandle, const QString &selfID);
- //typedef Callback3<uint, const QString&, const QString&, DBusError*> SetPresenceCallback;
- //void setSetPresenceCallback(const SetPresenceCallback &cb);
+ uint status() const;
+ void setStatus(uint newStatus, uint reason);
- void setSelfHandle(uint selfHandle);
- uint selfHandle() const;
+ typedef Callback2<BaseChannelPtr, const QVariantMap &, DBusError*> CreateChannelCallback;
+ void setCreateChannelCallback(const CreateChannelCallback &cb);
+ BaseChannelPtr createChannel(const QVariantMap &request, bool suppressHandler, DBusError *error);
typedef Callback1<void, DBusError*> ConnectCallback;
void setConnectCallback(const ConnectCallback &cb);
- typedef Callback3<QStringList, uint, const Tp::UIntList&, DBusError*> InspectHandlesCallback;
+ typedef Callback3<QStringList, uint, const Tp::UIntList &, DBusError*> InspectHandlesCallback;
void setInspectHandlesCallback(const InspectHandlesCallback &cb);
+ QStringList inspectHandles(uint handleType, const Tp::UIntList &handles, DBusError *error);
+
+ typedef Callback3<Tp::UIntList, uint, const QStringList &, DBusError*> RequestHandlesCallback;
+ void setRequestHandlesCallback(const RequestHandlesCallback &cb);
+ Tp::UIntList requestHandles(uint handleType, const QStringList &identifiers, DBusError *error);
Tp::ChannelInfoList channelsInfo();
Tp::ChannelDetailsList channelsDetails();
- BaseChannelPtr ensureChannel(const QString &channelType, uint targetHandleType,
- uint targetHandle, bool &yours, uint initiatorHandle, bool suppressHandler, DBusError *error);
- void addChannel(BaseChannelPtr channel);
+ BaseChannelPtr getExistingChannel(const QVariantMap &request, DBusError *error);
+ BaseChannelPtr ensureChannel(const QVariantMap &request, bool &yours, bool suppressHandler, DBusError *error);
+
+ void addChannel(BaseChannelPtr channel, bool suppressHandler = false);
QList<AbstractConnectionInterfacePtr> interfaces() const;
AbstractConnectionInterfacePtr interface(const QString &interfaceName) const;
bool plugInterface(const AbstractConnectionInterfacePtr &interface);
+ bool registerObject(DBusError *error = nullptr);
virtual QString uniqueName() const;
- bool registerObject(DBusError *error = NULL);
Q_SIGNALS:
void disconnected();
@@ -125,14 +122,16 @@ protected:
const QString &cmName, const QString &protocolName,
const QVariantMap &parameters);
- virtual bool registerObject(const QString &busName, const QString &objectPath,
- DBusError *error);
+ bool registerObject(const QString &busName, const QString &objectPath,
+ DBusError *error) override;
+
+ virtual bool matchChannel(const Tp::BaseChannelPtr &channel, const QVariantMap &request, Tp::DBusError *error);
private:
class Adaptee;
friend class Adaptee;
- class Private;
- friend class Private;
+ struct Private;
+ friend struct Private;
Private *mPriv;
};
@@ -143,13 +142,16 @@ class TP_QT_EXPORT AbstractConnectionInterface : public AbstractDBusServiceInter
public:
AbstractConnectionInterface(const QString &interfaceName);
- virtual ~AbstractConnectionInterface();
+ ~AbstractConnectionInterface() override;
+
+protected:
+ virtual void setBaseConnection(BaseConnection *connection);
private:
friend class BaseConnection;
- class Private;
- friend class Private;
+ struct Private;
+ friend struct Private;
Private *mPriv;
};
@@ -168,23 +170,25 @@ public:
new BaseConnectionRequestsInterfaceSubclass(connection));
}
- virtual ~BaseConnectionRequestsInterface();
+ ~BaseConnectionRequestsInterface() override;
- QVariantMap immutableProperties() const;
+ QVariantMap immutableProperties() const override;
Tp::RequestableChannelClassList requestableChannelClasses;
void ensureChannel(const QVariantMap &request, bool &yours,
QDBusObjectPath &channel, QVariantMap &details, DBusError* error);
void createChannel(const QVariantMap &request, QDBusObjectPath &channel,
QVariantMap &details, DBusError* error);
+
public Q_SLOTS:
void newChannels(const Tp::ChannelDetailsList &channels);
+ void channelClosed(const QDBusObjectPath &removed);
protected:
BaseConnectionRequestsInterface(BaseConnection* connection);
private:
- void createAdaptor();
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -193,38 +197,42 @@ private:
Private *mPriv;
};
-
class TP_QT_EXPORT BaseConnectionContactsInterface : public AbstractConnectionInterface
{
Q_OBJECT
Q_DISABLE_COPY(BaseConnectionContactsInterface)
-
public:
- static BaseConnectionContactsInterfacePtr create() {
+ static BaseConnectionContactsInterfacePtr create()
+ {
return BaseConnectionContactsInterfacePtr(new BaseConnectionContactsInterface());
}
template<typename BaseConnectionContactsInterfaceSubclass>
- static SharedPtr<BaseConnectionContactsInterfaceSubclass> create() {
+ static SharedPtr<BaseConnectionContactsInterfaceSubclass> create()
+ {
return SharedPtr<BaseConnectionContactsInterfaceSubclass>(
- new BaseConnectionContactsInterfaceSubclass());
+ new BaseConnectionContactsInterfaceSubclass());
}
- virtual ~BaseConnectionContactsInterface();
+ ~BaseConnectionContactsInterface() override;
- QVariantMap immutableProperties() const;
+ QVariantMap immutableProperties() const override;
- typedef Callback3<ContactAttributesMap, const Tp::UIntList&, const QStringList&, DBusError*> GetContactAttributesCallback;
- void setGetContactAttributesCallback(const GetContactAttributesCallback &cb);
- ContactAttributesMap getContactAttributes(const Tp::UIntList &handles,
- const QStringList &interfaces,
- DBusError *error);
+ QStringList contactAttributeInterfaces() const;
void setContactAttributeInterfaces(const QStringList &contactAttributeInterfaces);
+
+ typedef Callback3<Tp::ContactAttributesMap, const Tp::UIntList &, const QStringList &, DBusError*> GetContactAttributesCallback;
+ void setGetContactAttributesCallback(const GetContactAttributesCallback &cb);
+ Tp::ContactAttributesMap getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, DBusError *error);
+
+ void getContactByID(const QString &identifier, const QStringList &interfaces, uint &handle, QVariantMap &attributes, DBusError *error);
+
protected:
BaseConnectionContactsInterface();
+ void setBaseConnection(BaseConnection *connection) override;
private:
- void createAdaptor();
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -239,32 +247,37 @@ class TP_QT_EXPORT BaseConnectionSimplePresenceInterface : public AbstractConnec
Q_DISABLE_COPY(BaseConnectionSimplePresenceInterface)
public:
- static BaseConnectionSimplePresenceInterfacePtr create() {
+ static BaseConnectionSimplePresenceInterfacePtr create()
+ {
return BaseConnectionSimplePresenceInterfacePtr(new BaseConnectionSimplePresenceInterface());
}
- template<typename BaseConnectionSimplePresenceInterfaceSublclass>
- static SharedPtr<BaseConnectionSimplePresenceInterfaceSublclass> create() {
- return SharedPtr<BaseConnectionSimplePresenceInterfaceSublclass>(
- new BaseConnectionSimplePresenceInterfaceSublclass());
+ template<typename BaseConnectionSimplePresenceInterfaceSubclass>
+ static SharedPtr<BaseConnectionSimplePresenceInterfaceSubclass> create()
+ {
+ return SharedPtr<BaseConnectionSimplePresenceInterfaceSubclass>(
+ new BaseConnectionSimplePresenceInterfaceSubclass());
}
- virtual ~BaseConnectionSimplePresenceInterface();
+ ~BaseConnectionSimplePresenceInterface() override;
- QVariantMap immutableProperties() const;
+ Tp::SimpleStatusSpecMap statuses() const;
+ void setStatuses(const Tp::SimpleStatusSpecMap &statuses);
+
+ uint maximumStatusMessageLength() const;
+ void setMaximumStatusMessageLength(uint maximumStatusMessageLength);
- typedef Callback3<uint, const QString&, const QString&, DBusError*> SetPresenceCallback;
+ typedef Callback3<uint, const QString &, const QString &, DBusError*> SetPresenceCallback;
void setSetPresenceCallback(const SetPresenceCallback &cb);
void setPresences(const Tp::SimpleContactPresences &presences);
- void setStatuses(const SimpleStatusSpecMap &statuses);
- void setMaxmimumStatusMessageLength(uint maxmimumStatusMessageLength);
+
+ Tp::SimpleContactPresences getPresences(const Tp::UIntList &contacts);
+
protected:
BaseConnectionSimplePresenceInterface();
- Tp::SimpleStatusSpecMap statuses() const;
- int maximumStatusMessageLength() const;
private:
- void createAdaptor();
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -279,37 +292,195 @@ class TP_QT_EXPORT BaseConnectionContactListInterface : public AbstractConnectio
Q_DISABLE_COPY(BaseConnectionContactListInterface)
public:
- static BaseConnectionContactListInterfacePtr create() {
+ static BaseConnectionContactListInterfacePtr create()
+ {
return BaseConnectionContactListInterfacePtr(new BaseConnectionContactListInterface());
}
template<typename BaseConnectionContactListInterfaceSubclass>
- static SharedPtr<BaseConnectionContactListInterfaceSubclass> create() {
+ static SharedPtr<BaseConnectionContactListInterfaceSubclass> create()
+ {
return SharedPtr<BaseConnectionContactListInterfaceSubclass>(
- new BaseConnectionContactListInterfaceSubclass());
+ new BaseConnectionContactListInterfaceSubclass());
}
- virtual ~BaseConnectionContactListInterface();
-
- QVariantMap immutableProperties() const;
+ ~BaseConnectionContactListInterface() override;
+ uint contactListState() const;
void setContactListState(uint contactListState);
- void setContactListPersists(bool);
- void setCanChangeContactList(bool);
- void setRequestUsesMessage(bool);
- void setDownloadAtConnection(bool);
- typedef Callback3<Tp::ContactAttributesMap, const QStringList&, bool, DBusError*> GetContactListAttributesCallback;
+ bool contactListPersists() const;
+ void setContactListPersists(bool contactListPersists);
+
+ bool canChangeContactList() const;
+ void setCanChangeContactList(bool canChangeContactList);
+
+ bool requestUsesMessage() const;
+ void setRequestUsesMessage(bool requestUsesMessage);
+
+ bool downloadAtConnection() const;
+ void setDownloadAtConnection(bool downloadAtConnection);
+
+ typedef Callback3<Tp::ContactAttributesMap, const QStringList &, bool, DBusError*> GetContactListAttributesCallback;
void setGetContactListAttributesCallback(const GetContactListAttributesCallback &cb);
+ Tp::ContactAttributesMap getContactListAttributes(const QStringList &interfaces, bool hold, DBusError *error);
- typedef Callback3<void, const Tp::UIntList&, const QString&, DBusError*> RequestSubscriptionCallback;
+ typedef Callback3<void, const Tp::UIntList &, const QString &, DBusError*> RequestSubscriptionCallback;
void setRequestSubscriptionCallback(const RequestSubscriptionCallback &cb);
+ void requestSubscription(const Tp::UIntList &contacts, const QString &message, DBusError *error);
+
+ typedef Callback2<void, const Tp::UIntList &, DBusError*> AuthorizePublicationCallback;
+ void setAuthorizePublicationCallback(const AuthorizePublicationCallback &cb);
+ void authorizePublication(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback2<void, const Tp::UIntList &, DBusError*> RemoveContactsCallback;
+ void setRemoveContactsCallback(const RemoveContactsCallback &cb);
+ void removeContacts(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback2<void, const Tp::UIntList &, DBusError*> UnsubscribeCallback;
+ void setUnsubscribeCallback(const UnsubscribeCallback &cb);
+ void unsubscribe(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback2<void, const Tp::UIntList &, DBusError*> UnpublishCallback;
+ void setUnpublishCallback(const UnpublishCallback &cb);
+ void unpublish(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback1<void, DBusError*> DownloadCallback;
+ void setDownloadCallback(const DownloadCallback &cb);
+ void download(DBusError *error);
void contactsChangedWithID(const Tp::ContactSubscriptionMap &changes, const Tp::HandleIdentifierMap &identifiers, const Tp::HandleIdentifierMap &removals);
+
protected:
BaseConnectionContactListInterface();
private:
- void createAdaptor();
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseConnectionContactGroupsInterface : public AbstractConnectionInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseConnectionContactGroupsInterface)
+
+public:
+ static BaseConnectionContactGroupsInterfacePtr create()
+ {
+ return BaseConnectionContactGroupsInterfacePtr(new BaseConnectionContactGroupsInterface());
+ }
+ template<typename BaseConnectionContactGroupsInterfaceSubclass>
+ static SharedPtr<BaseConnectionContactGroupsInterfaceSubclass> create()
+ {
+ return SharedPtr<BaseConnectionContactGroupsInterfaceSubclass>(
+ new BaseConnectionContactGroupsInterfaceSubclass());
+ }
+
+ ~BaseConnectionContactGroupsInterface() override;
+
+ bool disjointGroups() const;
+ void setDisjointGroups(bool disjointGroups);
+
+ Tp::ContactMetadataStorageType groupStorage() const;
+ void setGroupStorage(Tp::ContactMetadataStorageType groupStorage);
+
+ QStringList groups() const;
+ void setGroups(const QStringList &groups);
+
+ typedef Callback3<void, uint, const QStringList &, DBusError*> SetContactGroupsCallback;
+ void setSetContactGroupsCallback(const SetContactGroupsCallback &cb);
+ void setContactGroups(uint contact, const QStringList &groups, DBusError *error);
+
+ typedef Callback3<void, const QString &, const Tp::UIntList &, DBusError*> SetGroupMembersCallback;
+ void setSetGroupMembersCallback(const SetGroupMembersCallback &cb);
+ void setGroupMembers(const QString &group, const Tp::UIntList &members, DBusError *error);
+
+ typedef Callback3<void, const QString &, const Tp::UIntList &, DBusError*> AddToGroupCallback;
+ void setAddToGroupCallback(const AddToGroupCallback &cb);
+ void addToGroup(const QString &group, const Tp::UIntList &members, DBusError *error);
+
+ typedef Callback3<void, const QString &, const Tp::UIntList &, DBusError*> RemoveFromGroupCallback;
+ void setRemoveFromGroupCallback(const RemoveFromGroupCallback &cb);
+ void removeFromGroup(const QString &group, const Tp::UIntList &members, DBusError *error);
+
+ typedef Callback2<void, const QString &, DBusError*> RemoveGroupCallback;
+ void setRemoveGroupCallback(const RemoveGroupCallback &cb);
+ void removeGroup(const QString &group, DBusError *error);
+
+ typedef Callback3<void, const QString &, const QString &, DBusError*> RenameGroupCallback;
+ void setRenameGroupCallback(const RenameGroupCallback &cb);
+ void renameGroup(const QString &oldName, const QString &newName, DBusError *error);
+
+ void groupsCreated(const QStringList &names);
+ void groupRenamed(const QString &oldName, const QString &newName);
+ void groupsRemoved(const QStringList &names);
+ void groupsChanged(const Tp::UIntList &contact, const QStringList &added, const QStringList &removed);
+
+protected:
+ BaseConnectionContactGroupsInterface();
+
+private:
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseConnectionContactInfoInterface : public AbstractConnectionInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseConnectionContactInfoInterface)
+
+public:
+ static BaseConnectionContactInfoInterfacePtr create()
+ {
+ return BaseConnectionContactInfoInterfacePtr(new BaseConnectionContactInfoInterface());
+ }
+ template<typename BaseConnectionContactInfoInterfaceSubclass>
+ static SharedPtr<BaseConnectionContactInfoInterfaceSubclass> create()
+ {
+ return SharedPtr<BaseConnectionContactInfoInterfaceSubclass>(
+ new BaseConnectionContactInfoInterfaceSubclass());
+ }
+
+ ~BaseConnectionContactInfoInterface() override;
+
+ Tp::ContactInfoFlags contactInfoFlags() const;
+ void setContactInfoFlags(const Tp::ContactInfoFlags &contactInfoFlags);
+
+ Tp::FieldSpecs supportedFields() const;
+ void setSupportedFields(const Tp::FieldSpecs &supportedFields);
+
+ typedef Callback2<Tp::ContactInfoMap, const Tp::UIntList &, DBusError*> GetContactInfoCallback;
+ void setGetContactInfoCallback(const GetContactInfoCallback &cb);
+ Tp::ContactInfoMap getContactInfo(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback2<void, const Tp::UIntList &, DBusError*> RefreshContactInfoCallback;
+ void setRefreshContactInfoCallback(const RefreshContactInfoCallback &cb);
+ void refreshContactInfo(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback2<Tp::ContactInfoFieldList, uint, DBusError*> RequestContactInfoCallback;
+ void setRequestContactInfoCallback(const RequestContactInfoCallback &cb);
+ Tp::ContactInfoFieldList requestContactInfo(uint contact, DBusError *error);
+
+ typedef Callback2<void, const Tp::ContactInfoFieldList &, DBusError*> SetContactInfoCallback;
+ void setSetContactInfoCallback(const SetContactInfoCallback &cb);
+ void setContactInfo(const Tp::ContactInfoFieldList &contactInfo, DBusError *error);
+
+ void contactInfoChanged(uint contact, const Tp::ContactInfoFieldList &contactInfo);
+
+protected:
+ BaseConnectionContactInfoInterface();
+
+private:
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -333,11 +504,7 @@ public:
new BaseConnectionAddressingInterfaceSubclass());
}
- virtual ~BaseConnectionAddressingInterface();
-
- QVariantMap immutableProperties() const;
-
-
+ ~BaseConnectionAddressingInterface() override;
typedef Callback6 < void, const QString&, const QStringList&, const QStringList&,
Tp::AddressingNormalizationMap&, Tp::ContactAttributesMap&, DBusError* > GetContactsByVCardFieldCallback;
@@ -351,7 +518,111 @@ protected:
BaseConnectionAddressingInterface();
private:
- void createAdaptor();
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseConnectionAliasingInterface : public AbstractConnectionInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseConnectionAliasingInterface)
+
+public:
+ static BaseConnectionAliasingInterfacePtr create()
+ {
+ return BaseConnectionAliasingInterfacePtr(new BaseConnectionAliasingInterface());
+ }
+ template<typename BaseConnectionAliasingInterfaceSubclass>
+ static SharedPtr<BaseConnectionAliasingInterfaceSubclass> create()
+ {
+ return SharedPtr<BaseConnectionAliasingInterfaceSubclass>(
+ new BaseConnectionAliasingInterfaceSubclass());
+ }
+
+ ~BaseConnectionAliasingInterface() override;
+
+ typedef Callback1<Tp::ConnectionAliasFlags, DBusError*> GetAliasFlagsCallback;
+ void setGetAliasFlagsCallback(const GetAliasFlagsCallback &cb);
+ Tp::ConnectionAliasFlags getAliasFlags(DBusError *error);
+
+ typedef Callback2<QStringList, const Tp::UIntList &, DBusError*> RequestAliasesCallback;
+ void setRequestAliasesCallback(const RequestAliasesCallback &cb);
+ QStringList requestAliases(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback2<Tp::AliasMap, const Tp::UIntList &, DBusError*> GetAliasesCallback;
+ void setGetAliasesCallback(const GetAliasesCallback &cb);
+ Tp::AliasMap getAliases(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback2<void, const Tp::AliasMap &, DBusError*> SetAliasesCallback;
+ void setSetAliasesCallback(const SetAliasesCallback &cb);
+ void setAliases(const Tp::AliasMap &aliases, DBusError *error);
+
+ void aliasesChanged(const Tp::AliasPairList &aliases);
+
+protected:
+ BaseConnectionAliasingInterface();
+
+private:
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseConnectionAvatarsInterface : public AbstractConnectionInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseConnectionAvatarsInterface)
+
+public:
+ static BaseConnectionAvatarsInterfacePtr create()
+ {
+ return BaseConnectionAvatarsInterfacePtr(new BaseConnectionAvatarsInterface());
+ }
+ template<typename BaseConnectionAvatarsInterfaceSubclass>
+ static SharedPtr<BaseConnectionAvatarsInterfaceSubclass> create()
+ {
+ return SharedPtr<BaseConnectionAvatarsInterfaceSubclass>(
+ new BaseConnectionAvatarsInterfaceSubclass());
+ }
+
+ ~BaseConnectionAvatarsInterface() override;
+
+ AvatarSpec avatarDetails() const;
+ void setAvatarDetails(const AvatarSpec &spec);
+
+ typedef Callback2<Tp::AvatarTokenMap, const Tp::UIntList &, DBusError*> GetKnownAvatarTokensCallback;
+ void setGetKnownAvatarTokensCallback(const GetKnownAvatarTokensCallback &cb);
+ Tp::AvatarTokenMap getKnownAvatarTokens(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback2<void, const Tp::UIntList &, DBusError*> RequestAvatarsCallback;
+ void setRequestAvatarsCallback(const RequestAvatarsCallback &cb);
+ void requestAvatars(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback3<QString, const QByteArray &, const QString &, DBusError*> SetAvatarCallback;
+ void setSetAvatarCallback(const SetAvatarCallback &cb);
+ QString setAvatar(const QByteArray &avatar, const QString &mimeType, DBusError *error);
+
+ typedef Callback1<void, DBusError*> ClearAvatarCallback;
+ void setClearAvatarCallback(const ClearAvatarCallback &cb);
+ void clearAvatar(DBusError *error);
+
+ void avatarUpdated(uint contact, const QString &newAvatarToken);
+ void avatarRetrieved(uint contact, const QString &token, const QByteArray &avatar, const QString &type);
+
+protected:
+ BaseConnectionAvatarsInterface();
+
+private:
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -359,6 +630,91 @@ private:
friend struct Private;
Private *mPriv;
};
+
+class TP_QT_EXPORT BaseConnectionClientTypesInterface : public AbstractConnectionInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseConnectionClientTypesInterface)
+
+public:
+ static BaseConnectionClientTypesInterfacePtr create()
+ {
+ return BaseConnectionClientTypesInterfacePtr(new BaseConnectionClientTypesInterface());
+ }
+ template<typename BaseConnectionClientTypesInterfaceSubclass>
+ static SharedPtr<BaseConnectionClientTypesInterfaceSubclass> create()
+ {
+ return SharedPtr<BaseConnectionClientTypesInterfaceSubclass>(
+ new BaseConnectionClientTypesInterfaceSubclass());
+ }
+
+ ~BaseConnectionClientTypesInterface() override;
+
+ typedef Callback2<Tp::ContactClientTypes, const Tp::UIntList &, DBusError*> GetClientTypesCallback;
+ void setGetClientTypesCallback(const GetClientTypesCallback &cb);
+ Tp::ContactClientTypes getClientTypes(const Tp::UIntList &contacts, DBusError *error);
+
+ typedef Callback2<QStringList, uint, DBusError*> RequestClientTypesCallback;
+ void setRequestClientTypesCallback(const RequestClientTypesCallback &cb);
+ QStringList requestClientTypes(uint contact, DBusError *error);
+
+ void clientTypesUpdated(uint contact, const QStringList &clientTypes);
+
+protected:
+ BaseConnectionClientTypesInterface();
+
+private:
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+class TP_QT_EXPORT BaseConnectionContactCapabilitiesInterface : public AbstractConnectionInterface
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseConnectionContactCapabilitiesInterface)
+
+public:
+ static BaseConnectionContactCapabilitiesInterfacePtr create()
+ {
+ return BaseConnectionContactCapabilitiesInterfacePtr(new BaseConnectionContactCapabilitiesInterface());
+ }
+ template<typename BaseConnectionContactCapabilitiesInterfaceSubclass>
+ static SharedPtr<BaseConnectionContactCapabilitiesInterfaceSubclass> create()
+ {
+ return SharedPtr<BaseConnectionContactCapabilitiesInterfaceSubclass>(
+ new BaseConnectionContactCapabilitiesInterfaceSubclass());
+ }
+
+ ~BaseConnectionContactCapabilitiesInterface() override;
+
+ typedef Callback2<void, const Tp::HandlerCapabilitiesList &, DBusError*> UpdateCapabilitiesCallback;
+ void setUpdateCapabilitiesCallback(const UpdateCapabilitiesCallback &cb);
+ void updateCapabilities(const Tp::HandlerCapabilitiesList &handlerCapabilities, DBusError *error);
+
+ typedef Callback2<Tp::ContactCapabilitiesMap, const Tp::UIntList &, DBusError*> GetContactCapabilitiesCallback;
+ void setGetContactCapabilitiesCallback(const GetContactCapabilitiesCallback &cb);
+ Tp::ContactCapabilitiesMap getContactCapabilities(const Tp::UIntList &handles, DBusError *error);
+
+ void contactCapabilitiesChanged(const Tp::ContactCapabilitiesMap &caps);
+
+protected:
+ BaseConnectionContactCapabilitiesInterface();
+
+private:
+ void createAdaptor() override;
+
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
}
#endif
diff --git a/TelepathyQt/base-debug-internal.h b/TelepathyQt/base-debug-internal.h
new file mode 100644
index 00000000..514629c7
--- /dev/null
+++ b/TelepathyQt/base-debug-internal.h
@@ -0,0 +1,58 @@
+/**
+ * This file is part of TelepathyQt
+ *
+ * @copyright Copyright (C) 2016 Alexandr Akulich <akulichalexander@gmail.com>
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "TelepathyQt/_gen/svc-debug.h"
+
+#include <TelepathyQt/MethodInvocationContext>
+
+#include <QObject>
+#include <QString>
+#include <QStringList>
+#include <QVariantMap>
+
+namespace Tp
+{
+
+class TP_QT_NO_EXPORT BaseDebug::Adaptee : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
+
+public:
+ Adaptee(const QDBusConnection &dbusConnection, BaseDebug *interface);
+
+ bool isEnabled();
+
+Q_SIGNALS:
+ void newDebugMessage(double time, const QString& domain, uint level, const QString& message);
+
+public Q_SLOTS:
+ void setEnabled(bool enabled);
+
+private Q_SLOTS:
+ void getMessages(
+ const Tp::Service::DebugAdaptor::GetMessagesContextPtr &context);
+
+public:
+ BaseDebug *mInterface;
+};
+
+}
diff --git a/TelepathyQt/base-debug.cpp b/TelepathyQt/base-debug.cpp
new file mode 100644
index 00000000..6e29e3da
--- /dev/null
+++ b/TelepathyQt/base-debug.cpp
@@ -0,0 +1,214 @@
+/**
+ * This file is part of TelepathyQt
+ *
+ * @copyright Copyright (C) 2016 Alexandr Akulich <akulichalexander@gmail.com>
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <TelepathyQt/BaseDebug>
+#include "TelepathyQt/base-debug-internal.h"
+
+#include <TelepathyQt/DBusObject>
+
+#include "TelepathyQt/_gen/base-debug.moc.hpp"
+#include "TelepathyQt/_gen/base-debug-internal.moc.hpp"
+
+namespace Tp
+{
+
+struct TP_QT_NO_EXPORT BaseDebug::Private
+{
+ Private(BaseDebug *parent, const QDBusConnection &dbusConnection)
+ : parent(parent),
+ enabled(false),
+ getMessagesLimit(0),
+ lastMessageIndex(-1),
+ adaptee(new BaseDebug::Adaptee(dbusConnection, parent))
+ {
+ }
+
+ BaseDebug *parent;
+ bool enabled;
+ int getMessagesLimit;
+ int lastMessageIndex;
+
+ DebugMessageList messages;
+
+ GetMessagesCallback getMessageCB;
+ BaseDebug::Adaptee *adaptee;
+};
+
+BaseDebug::Adaptee::Adaptee(const QDBusConnection &dbusConnection, BaseDebug *interface)
+ : QObject(interface),
+ mInterface(interface)
+{
+ (void) new Service::DebugAdaptor(dbusConnection, this, interface->dbusObject());
+}
+
+bool BaseDebug::Adaptee::isEnabled()
+{
+ return mInterface->isEnabled();
+}
+
+void BaseDebug::Adaptee::setEnabled(bool enabled)
+{
+ mInterface->mPriv->enabled = enabled;
+}
+
+void BaseDebug::Adaptee::getMessages(const Service::DebugAdaptor::GetMessagesContextPtr &context)
+{
+ DBusError error;
+ DebugMessageList messages = mInterface->getMessages(&error);
+
+ if (error.isValid()) {
+ context->setFinishedWithError(error.name(), error.message());
+ return;
+ }
+ context->setFinished(messages);
+}
+
+BaseDebug::BaseDebug(const QDBusConnection &dbusConnection) :
+ DBusService(dbusConnection),
+ mPriv(new Private(this, dbusConnection))
+{
+}
+
+bool BaseDebug::isEnabled() const
+{
+ return mPriv->enabled;
+}
+
+int BaseDebug::getMessagesLimit() const
+{
+ return mPriv->getMessagesLimit;
+}
+
+void BaseDebug::setGetMessagesCallback(const BaseDebug::GetMessagesCallback &cb)
+{
+ mPriv->getMessageCB = cb;
+}
+
+DebugMessageList BaseDebug::getMessages(Tp::DBusError *error) const
+{
+ if (!mPriv->getMessageCB.isValid()) {
+ if (mPriv->getMessagesLimit) {
+ if (mPriv->lastMessageIndex < 0) {
+ return mPriv->messages;
+ } else {
+ return mPriv->messages.mid(mPriv->lastMessageIndex + 1) + mPriv->messages.mid(0, mPriv->lastMessageIndex + 1);
+ }
+ }
+ error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
+ return DebugMessageList();
+ }
+
+ return mPriv->getMessageCB(error);
+}
+
+void BaseDebug::setEnabled(bool enabled)
+{
+ mPriv->enabled = enabled;
+}
+
+void BaseDebug::setGetMessagesLimit(int limit)
+{
+ mPriv->getMessagesLimit = limit;
+ DebugMessageList messages;
+
+ if (mPriv->lastMessageIndex < 0) {
+ messages = mPriv->messages;
+ } else {
+ messages = mPriv->messages.mid(mPriv->lastMessageIndex + 1) + mPriv->messages.mid(0, mPriv->lastMessageIndex + 1);
+ }
+
+ mPriv->lastMessageIndex = -1;
+
+ if (mPriv->messages.count() <= limit) {
+ mPriv->messages = messages;
+ } else {
+ mPriv->messages = messages.mid(messages.count() - limit, limit);
+ }
+}
+
+void BaseDebug::clear()
+{
+ mPriv->messages.clear();
+ mPriv->lastMessageIndex = -1;
+}
+
+void BaseDebug::newDebugMessage(const QString &domain, DebugLevel level, const QString &message)
+{
+ qint64 msec = QDateTime::currentMSecsSinceEpoch();
+ double time = msec / 1000 + (msec % 1000 / 1000.0);
+
+ newDebugMessage(time, domain, level, message);
+}
+
+void BaseDebug::newDebugMessage(double time, const QString &domain, DebugLevel level, const QString &message)
+{
+ if (mPriv->getMessagesLimit != 0) {
+ DebugMessage newMessage;
+ newMessage.timestamp = time;
+ newMessage.domain = domain;
+ newMessage.level = level;
+ newMessage.message = message;
+
+ if (mPriv->messages.count() == mPriv->getMessagesLimit) {
+ ++mPriv->lastMessageIndex;
+
+ if (mPriv->lastMessageIndex >= mPriv->messages.count()) {
+ mPriv->lastMessageIndex = 0;
+ }
+
+ mPriv->messages[mPriv->lastMessageIndex] = newMessage;
+ } else { // This works when the limit is not hitted yet, or when there is no limit at all (negative limit number)
+ mPriv->messages << newMessage;
+ }
+ }
+
+ if (!isEnabled()) {
+ return;
+ }
+
+ QMetaObject::invokeMethod(mPriv->adaptee, "newDebugMessage",
+ Q_ARG(double, time), Q_ARG(QString, domain),
+ Q_ARG(uint, level), Q_ARG(QString, message)); //Can simply use emit in Qt5
+}
+
+QVariantMap BaseDebug::immutableProperties() const
+{
+ // There is no immutable properties.
+ return QVariantMap();
+}
+
+bool BaseDebug::registerObject(const QString &busName, DBusError *error)
+{
+ if (isRegistered()) {
+ return true;
+ }
+
+ DBusError _error;
+ bool ret = DBusService::registerObject(busName, TP_QT_DEBUG_OBJECT_PATH, &_error);
+
+ if (!ret && error) {
+ error->set(_error.name(), _error.message());
+ }
+
+ return ret;
+}
+
+}
diff --git a/TelepathyQt/base-debug.h b/TelepathyQt/base-debug.h
new file mode 100644
index 00000000..8abd5975
--- /dev/null
+++ b/TelepathyQt/base-debug.h
@@ -0,0 +1,74 @@
+/**
+ * This file is part of TelepathyQt
+ *
+ * @copyright Copyright (C) 2016 Alexandr Akulich <akulichalexander@gmail.com>
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _TelepathyQt_base_debug_h_HEADER_GUARD_
+#define _TelepathyQt_base_debug_h_HEADER_GUARD_
+
+#ifndef IN_TP_QT_HEADER
+#error IN_TP_QT_HEADER
+#endif
+
+#include <TelepathyQt/Callbacks>
+#include <TelepathyQt/Constants>
+#include <TelepathyQt/DBusService>
+#include <TelepathyQt/Global>
+#include <TelepathyQt/Types>
+
+namespace Tp
+{
+
+class TP_QT_EXPORT BaseDebug : public DBusService
+{
+ Q_OBJECT
+public:
+ explicit BaseDebug(const QDBusConnection &dbusConnection = QDBusConnection::sessionBus());
+
+ bool isEnabled() const;
+ int getMessagesLimit() const;
+
+ typedef Callback1<DebugMessageList, DBusError*> GetMessagesCallback;
+ void setGetMessagesCallback(const GetMessagesCallback &cb);
+
+ DebugMessageList getMessages(DBusError *error) const;
+
+public Q_SLOTS:
+ void setEnabled(bool enabled);
+ void setGetMessagesLimit(int limit);
+ void clear();
+
+ void newDebugMessage(const QString &domain, DebugLevel level, const QString &message);
+ void newDebugMessage(double time, const QString &domain, DebugLevel level, const QString &message);
+
+ QVariantMap immutableProperties() const override;
+
+ bool registerObject(const QString &busName, DBusError *error = nullptr);
+
+protected:
+ class Adaptee;
+ friend class Adaptee;
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+} // namespace Tp
+
+#endif // _TelepathyQt_base_debug_h_HEADER_GUARD_
diff --git a/TelepathyQt/base-protocol-internal.h b/TelepathyQt/base-protocol-internal.h
index ae622fd3..85069761 100644
--- a/TelepathyQt/base-protocol-internal.h
+++ b/TelepathyQt/base-protocol-internal.h
@@ -48,7 +48,7 @@ class TP_QT_NO_EXPORT BaseProtocol::Adaptee : public QObject
public:
Adaptee(const QDBusConnection &dbusConnection, BaseProtocol *protocol);
- ~Adaptee();
+ ~Adaptee() override;
QStringList interfaces() const;
QStringList connectionInterfaces() const;
@@ -77,7 +77,7 @@ class TP_QT_NO_EXPORT BaseProtocolAddressingInterface::Adaptee : public QObject
public:
Adaptee(BaseProtocolAddressingInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
QStringList addressableVCardFields() const;
QStringList addressableURISchemes() const;
@@ -106,7 +106,7 @@ class TP_QT_NO_EXPORT BaseProtocolAvatarsInterface::Adaptee : public QObject
public:
Adaptee(BaseProtocolAvatarsInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
QStringList supportedAvatarMIMETypes() const;
uint minimumAvatarHeight() const;
@@ -128,7 +128,7 @@ class TP_QT_NO_EXPORT BaseProtocolPresenceInterface::Adaptee : public QObject
public:
Adaptee(BaseProtocolPresenceInterface *interface);
- ~Adaptee();
+ ~Adaptee() override;
SimpleStatusSpecMap statuses() const;
diff --git a/TelepathyQt/base-protocol.cpp b/TelepathyQt/base-protocol.cpp
index 70120f22..f2b2fa25 100644
--- a/TelepathyQt/base-protocol.cpp
+++ b/TelepathyQt/base-protocol.cpp
@@ -814,20 +814,6 @@ BaseProtocolAddressingInterface::~BaseProtocolAddressingInterface()
}
/**
- * Return the immutable properties of this interface.
- *
- * Immutable properties cannot change after the interface has been registered
- * on a service on the bus with registerInterface().
- *
- * \return The immutable properties of this interface.
- */
-QVariantMap BaseProtocolAddressingInterface::immutableProperties() const
-{
- // no immutable property
- return QVariantMap();
-}
-
-/**
* Return the list of addressable vcard fields that have been set with
* setAddressableVCardFields().
*
diff --git a/TelepathyQt/base-protocol.h b/TelepathyQt/base-protocol.h
index 0526d653..4817b37a 100644
--- a/TelepathyQt/base-protocol.h
+++ b/TelepathyQt/base-protocol.h
@@ -71,11 +71,11 @@ public:
return SharedPtr<BaseProtocolSubclass>(new BaseProtocolSubclass(dbusConnection, name));
}
- virtual ~BaseProtocol();
+ ~BaseProtocol() override;
QString name() const;
- QVariantMap immutableProperties() const;
+ QVariantMap immutableProperties() const override;
// Proto
QStringList connectionInterfaces() const;
@@ -118,15 +118,15 @@ public:
protected:
BaseProtocol(const QDBusConnection &dbusConnection, const QString &name);
- virtual bool registerObject(const QString &busName, const QString &objectPath,
- DBusError *error);
+ bool registerObject(const QString &busName, const QString &objectPath,
+ DBusError *error) override;
private:
friend class BaseConnectionManager;
class Adaptee;
friend class Adaptee;
- class Private;
- friend class Private;
+ struct Private;
+ friend struct Private;
Private *mPriv;
};
@@ -137,13 +137,13 @@ class TP_QT_EXPORT AbstractProtocolInterface : public AbstractDBusServiceInterfa
public:
AbstractProtocolInterface(const QString &interfaceName);
- virtual ~AbstractProtocolInterface();
+ ~AbstractProtocolInterface() override;
private:
friend class BaseProtocol;
- class Private;
- friend class Private;
+ struct Private;
+ friend struct Private;
Private *mPriv;
};
@@ -164,9 +164,7 @@ public:
new BaseProtocolAddressingInterfaceSubclass());
}
- virtual ~BaseProtocolAddressingInterface();
-
- QVariantMap immutableProperties() const;
+ ~BaseProtocolAddressingInterface() override;
QStringList addressableVCardFields() const;
void setAddressableVCardFields(const QStringList &vcardFields);
@@ -186,7 +184,7 @@ protected:
BaseProtocolAddressingInterface();
private:
- void createAdaptor();
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -212,9 +210,9 @@ public:
new BaseProtocolAvatarsInterfaceSubclass());
}
- virtual ~BaseProtocolAvatarsInterface();
+ ~BaseProtocolAvatarsInterface() override;
- QVariantMap immutableProperties() const;
+ QVariantMap immutableProperties() const override;
AvatarSpec avatarDetails() const;
void setAvatarDetails(const AvatarSpec &spec);
@@ -223,7 +221,7 @@ protected:
BaseProtocolAvatarsInterface();
private:
- void createAdaptor();
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
@@ -249,9 +247,9 @@ public:
new BaseProtocolPresenceInterfaceSubclass());
}
- virtual ~BaseProtocolPresenceInterface();
+ ~BaseProtocolPresenceInterface() override;
- QVariantMap immutableProperties() const;
+ QVariantMap immutableProperties() const override;
PresenceSpecList statuses() const;
void setStatuses(const PresenceSpecList &statuses);
@@ -260,7 +258,7 @@ protected:
BaseProtocolPresenceInterface();
private:
- void createAdaptor();
+ void createAdaptor() override;
class Adaptee;
friend class Adaptee;
diff --git a/TelepathyQt/call-channel.cpp b/TelepathyQt/call-channel.cpp
index ffe2626e..4a5cb8b0 100644
--- a/TelepathyQt/call-channel.cpp
+++ b/TelepathyQt/call-channel.cpp
@@ -521,11 +521,11 @@ CallMemberFlags CallChannel::remoteMemberFlags(const ContactPtr &member) const
{
if (!isReady(FeatureCallMembers)) {
warning() << "CallChannel::remoteMemberFlags() used with FeatureCallMembers not ready";
- return (CallMemberFlags) 0;
+ return (CallMemberFlags) nullptr;
}
if (!member) {
- return (CallMemberFlags) 0;
+ return (CallMemberFlags) nullptr;
}
for (CallMemberMap::const_iterator i = mPriv->callMembers.constBegin();
@@ -538,7 +538,7 @@ CallMemberFlags CallChannel::remoteMemberFlags(const ContactPtr &member) const
}
}
- return (CallMemberFlags) 0;
+ return (CallMemberFlags) nullptr;
}
/**
diff --git a/TelepathyQt/call-channel.h b/TelepathyQt/call-channel.h
index aebb0ba1..4cb1e26f 100644
--- a/TelepathyQt/call-channel.h
+++ b/TelepathyQt/call-channel.h
@@ -47,7 +47,7 @@ public:
static CallChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~CallChannel();
+ ~CallChannel() override;
bool handlerStreamingRequired() const;
StreamTransportType initialTransportType() const;
diff --git a/TelepathyQt/call-content.cpp b/TelepathyQt/call-content.cpp
index 31bf9583..bc13525c 100644
--- a/TelepathyQt/call-content.cpp
+++ b/TelepathyQt/call-content.cpp
@@ -340,6 +340,7 @@ void CallContent::gotMainProperties(PendingOperation *op)
mPriv->name = qdbus_cast<QString>(props[QLatin1String("Name")]);
mPriv->type = qdbus_cast<uint>(props[QLatin1String("Type")]);
mPriv->disposition = qdbus_cast<uint>(props[QLatin1String("Disposition")]);
+ setInterfaces(qdbus_cast<QStringList>(props[QLatin1String("Interfaces")]));
ObjectPathList streamsPaths = qdbus_cast<ObjectPathList>(props[QLatin1String("Streams")]);
if (streamsPaths.size() != 0) {
diff --git a/TelepathyQt/call-content.h b/TelepathyQt/call-content.h
index 369b286b..80e65498 100644
--- a/TelepathyQt/call-content.h
+++ b/TelepathyQt/call-content.h
@@ -43,7 +43,7 @@ class TP_QT_EXPORT CallContent : public StatefulDBusProxy,
Q_DISABLE_COPY(CallContent)
public:
- ~CallContent();
+ ~CallContent() override;
CallChannelPtr channel() const;
@@ -89,7 +89,7 @@ class TP_QT_EXPORT PendingCallContent : public PendingOperation
Q_DISABLE_COPY(PendingCallContent)
public:
- ~PendingCallContent();
+ ~PendingCallContent() override;
CallContentPtr content() const;
diff --git a/TelepathyQt/call-interfaces.xml b/TelepathyQt/call-interfaces.xml
new file mode 100644
index 00000000..429cbc2b
--- /dev/null
+++ b/TelepathyQt/call-interfaces.xml
@@ -0,0 +1,9 @@
+<tp:spec
+ xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+<tp:title>Call interfaces, version 1</tp:title>
+
+<xi:include href="../spec/Call_Interface_Mute.xml" />
+
+</tp:spec>
diff --git a/TelepathyQt/call-stream.h b/TelepathyQt/call-stream.h
index ff62b7c4..e14fc145 100644
--- a/TelepathyQt/call-stream.h
+++ b/TelepathyQt/call-stream.h
@@ -48,7 +48,7 @@ class TP_QT_EXPORT CallStream : public StatefulDBusProxy,
Q_DISABLE_COPY(CallStream)
public:
- ~CallStream();
+ ~CallStream() override;
CallContentPtr content() const;
diff --git a/TelepathyQt/callbacks.h b/TelepathyQt/callbacks.h
index 18dd8048..90d4dcd2 100644
--- a/TelepathyQt/callbacks.h
+++ b/TelepathyQt/callbacks.h
@@ -55,22 +55,22 @@ struct BaseFunctorCaller : public AbstractFunctorCaller
BaseFunctorCaller(const Functor &functor, AbstractFunctorCaller::HookType invokeMethodHook)
: AbstractFunctorCaller(invokeMethodHook),
functor(functor) {}
- virtual ~BaseFunctorCaller() {}
+ ~BaseFunctorCaller() override {}
- virtual AbstractFunctorCaller *clone() const { return new T(functor); }
+ AbstractFunctorCaller *clone() const override { return new T(functor); }
Functor functor;
};
struct TP_QT_EXPORT BaseCallback
{
- BaseCallback() : caller(0) {}
+ BaseCallback() : caller(nullptr) {}
/* takes ownership of caller */
BaseCallback(AbstractFunctorCaller *caller) : caller(caller) {}
BaseCallback(const BaseCallback &other) : caller(other.caller->clone()) {}
virtual ~BaseCallback() { delete caller; }
- bool isValid() const { return caller != 0; }
+ bool isValid() const { return caller != nullptr; }
BaseCallback &operator=(const BaseCallback &other)
{
diff --git a/TelepathyQt/capabilities-base.h b/TelepathyQt/capabilities-base.h
index ed1b5acf..c1540660 100644
--- a/TelepathyQt/capabilities-base.h
+++ b/TelepathyQt/capabilities-base.h
@@ -85,6 +85,6 @@ private:
} // Tp
-Q_DECLARE_METATYPE(Tp::CapabilitiesBase);
+Q_DECLARE_METATYPE(Tp::CapabilitiesBase)
#endif
diff --git a/TelepathyQt/captcha-authentication-internal.h b/TelepathyQt/captcha-authentication-internal.h
index f5b781d6..0eeb55ea 100644
--- a/TelepathyQt/captcha-authentication-internal.h
+++ b/TelepathyQt/captcha-authentication-internal.h
@@ -39,7 +39,7 @@ class TP_QT_NO_EXPORT PendingCaptchaAnswer : public PendingOperation
public:
PendingCaptchaAnswer(const QDBusPendingCall &call,
const CaptchaAuthenticationPtr &object);
- ~PendingCaptchaAnswer();
+ ~PendingCaptchaAnswer() override;
private Q_SLOTS:
void onCaptchaStatusChanged(Tp::CaptchaStatus status);
@@ -63,7 +63,7 @@ class TP_QT_NO_EXPORT PendingCaptchaCancel : public PendingOperation
public:
PendingCaptchaCancel(const QDBusPendingCall &call,
const CaptchaAuthenticationPtr &object);
- ~PendingCaptchaCancel();
+ ~PendingCaptchaCancel() override;
private Q_SLOTS:
void onCancelFinished();
diff --git a/TelepathyQt/captcha-authentication.h b/TelepathyQt/captcha-authentication.h
index 15bd8231..ecc03a8d 100644
--- a/TelepathyQt/captcha-authentication.h
+++ b/TelepathyQt/captcha-authentication.h
@@ -61,7 +61,7 @@ public:
};
Q_DECLARE_FLAGS(ChallengeTypes, ChallengeType)
- virtual ~CaptchaAuthentication();
+ ~CaptchaAuthentication() override;
ChannelPtr channel() const;
diff --git a/TelepathyQt/captcha.h b/TelepathyQt/captcha.h
index 9f35b2ea..b04666e5 100644
--- a/TelepathyQt/captcha.h
+++ b/TelepathyQt/captcha.h
@@ -40,7 +40,7 @@ public:
Captcha(const Captcha &other);
~Captcha();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
Captcha &operator=(const Captcha &rhs);
diff --git a/TelepathyQt/channel-class-features.h b/TelepathyQt/channel-class-features.h
index bd03117e..ec71389e 100644
--- a/TelepathyQt/channel-class-features.h
+++ b/TelepathyQt/channel-class-features.h
@@ -40,6 +40,6 @@ typedef QPair<ChannelClassSpec, Features> ChannelClassFeatures;
} // Tp
-Q_DECLARE_METATYPE(Tp::ChannelClassFeatures);
+Q_DECLARE_METATYPE(Tp::ChannelClassFeatures)
#endif
diff --git a/TelepathyQt/channel-class-spec.cpp b/TelepathyQt/channel-class-spec.cpp
index ae74b276..227ae29c 100644
--- a/TelepathyQt/channel-class-spec.cpp
+++ b/TelepathyQt/channel-class-spec.cpp
@@ -107,7 +107,7 @@ ChannelClassSpec::~ChannelClassSpec()
bool ChannelClassSpec::isValid() const
{
- return mPriv.constData() != 0 &&
+ return mPriv.constData() != nullptr &&
!(qdbus_cast<QString>(
mPriv->props.value(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType")))
.isEmpty()) &&
@@ -153,17 +153,17 @@ bool ChannelClassSpec::matches(const QVariantMap &immutableProperties) const
bool ChannelClassSpec::hasProperty(const QString &qualifiedName) const
{
- return mPriv.constData() != 0 ? mPriv->props.contains(qualifiedName) : false;
+ return mPriv.constData() != nullptr ? mPriv->props.contains(qualifiedName) : false;
}
QVariant ChannelClassSpec::property(const QString &qualifiedName) const
{
- return mPriv.constData() != 0 ? mPriv->props.value(qualifiedName) : QVariant();
+ return mPriv.constData() != nullptr ? mPriv->props.value(qualifiedName) : QVariant();
}
void ChannelClassSpec::setProperty(const QString &qualifiedName, const QVariant &value)
{
- if (mPriv.constData() == 0) {
+ if (mPriv.constData() == nullptr) {
mPriv = new Private;
}
@@ -172,7 +172,7 @@ void ChannelClassSpec::setProperty(const QString &qualifiedName, const QVariant
void ChannelClassSpec::unsetProperty(const QString &qualifiedName)
{
- if (mPriv.constData() == 0) {
+ if (mPriv.constData() == nullptr) {
// No properties set for sure, so don't have to unset any
return;
}
@@ -182,7 +182,7 @@ void ChannelClassSpec::unsetProperty(const QString &qualifiedName)
QVariantMap ChannelClassSpec::allProperties() const
{
- return mPriv.constData() != 0 ? mPriv->props : QVariantMap();
+ return mPriv.constData() != nullptr ? mPriv->props : QVariantMap();
}
ChannelClass ChannelClassSpec::bareClass() const
diff --git a/TelepathyQt/channel-class-spec.h b/TelepathyQt/channel-class-spec.h
index 90c6a24d..fb3c08de 100644
--- a/TelepathyQt/channel-class-spec.h
+++ b/TelepathyQt/channel-class-spec.h
@@ -313,9 +313,16 @@ inline uint qHash(const ChannelClassSpecList &specList)
return qHash(uniqueSet);
}
+inline uint qHash(const QList<ChannelClassSpec> &specList)
+{
+ // Make it unique by converting to QSet
+ QSet<ChannelClassSpec> uniqueSet = specList.toSet();
+ return qHash(uniqueSet);
+}
+
} // Tp
-Q_DECLARE_METATYPE(Tp::ChannelClassSpec);
-Q_DECLARE_METATYPE(Tp::ChannelClassSpecList);
+Q_DECLARE_METATYPE(Tp::ChannelClassSpec)
+Q_DECLARE_METATYPE(Tp::ChannelClassSpecList)
#endif
diff --git a/TelepathyQt/channel-dispatch-operation-internal.h b/TelepathyQt/channel-dispatch-operation-internal.h
index 7eef7253..03863f17 100644
--- a/TelepathyQt/channel-dispatch-operation-internal.h
+++ b/TelepathyQt/channel-dispatch-operation-internal.h
@@ -36,7 +36,7 @@ class TP_QT_NO_EXPORT ChannelDispatchOperation::PendingClaim : public PendingOpe
public:
PendingClaim(const ChannelDispatchOperationPtr &op,
const AbstractClientHandlerPtr &handler = AbstractClientHandlerPtr());
- ~PendingClaim();
+ ~PendingClaim() override;
private Q_SLOTS:
TP_QT_NO_EXPORT void onClaimFinished(Tp::PendingOperation *op);
diff --git a/TelepathyQt/channel-dispatch-operation.h b/TelepathyQt/channel-dispatch-operation.h
index 9d319d23..cd4b3cf5 100644
--- a/TelepathyQt/channel-dispatch-operation.h
+++ b/TelepathyQt/channel-dispatch-operation.h
@@ -63,7 +63,7 @@ public:
const ConnectionFactoryConstPtr &connectionFactory,
const ChannelFactoryConstPtr &channelFactory,
const ContactFactoryConstPtr &contactFactory);
- virtual ~ChannelDispatchOperation();
+ ~ChannelDispatchOperation() override;
ConnectionPtr connection() const;
diff --git a/TelepathyQt/channel-factory.h b/TelepathyQt/channel-factory.h
index 86038d91..711b60d2 100644
--- a/TelepathyQt/channel-factory.h
+++ b/TelepathyQt/channel-factory.h
@@ -52,7 +52,7 @@ public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
struct TP_QT_EXPORT Constructor : public RefCounted
{
- virtual ~Constructor() {}
+ ~Constructor() override {}
virtual ChannelPtr construct(const ConnectionPtr &conn, const QString &objectPath,
const QVariantMap &immutableProperties) const = 0;
@@ -63,7 +63,7 @@ public:
static ChannelFactoryPtr create(const QDBusConnection &bus);
- virtual ~ChannelFactory();
+ ~ChannelFactory() override;
Features featuresForTextChats(const QVariantMap &additionalProps = QVariantMap()) const;
void addFeaturesForTextChats(const Features &features,
@@ -374,19 +374,19 @@ protected:
return ConstructorPtr(new SubclassCtor<Subclass>());
}
- virtual ~SubclassCtor() {}
+ ~SubclassCtor() override {}
ChannelPtr construct(const ConnectionPtr &conn, const QString &objectPath,
- const QVariantMap &immutableProperties) const
+ const QVariantMap &immutableProperties) const override
{
return Subclass::create(conn, objectPath, immutableProperties);
}
};
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
- virtual QString finalBusNameFrom(const QString &uniqueOrWellKnown) const;
+ QString finalBusNameFrom(const QString &uniqueOrWellKnown) const override;
// Nothing we'd like to prepare()
- virtual Features featuresFor(const DBusProxyPtr &proxy) const;
+ Features featuresFor(const DBusProxyPtr &proxy) const override;
private:
struct Private;
diff --git a/TelepathyQt/channel-request.cpp b/TelepathyQt/channel-request.cpp
index 3b138637..3189f499 100644
--- a/TelepathyQt/channel-request.cpp
+++ b/TelepathyQt/channel-request.cpp
@@ -153,8 +153,8 @@ void ChannelRequest::Private::introspectMain(ChannelRequest::Private *self)
bool needIntrospectMainProps = false;
const char *propertiesNames[] = { "Account", "UserActionTime",
"PreferredHandler", "Requests", "Interfaces",
- NULL };
- for (unsigned i = 0; propertiesNames[i] != NULL; ++i) {
+ nullptr };
+ for (unsigned i = 0; propertiesNames[i] != nullptr; ++i) {
key = TP_QT_IFACE_CHANNEL_REQUEST + QLatin1String(".");
key += QLatin1String(propertiesNames[i]);
if (!self->immutableProperties.contains(key)) {
@@ -188,7 +188,7 @@ void ChannelRequest::Private::introspectMain(ChannelRequest::Private *self)
void ChannelRequest::Private::extractMainProps(const QVariantMap &props, bool lastCall)
{
- PendingReady *readyOp = 0;
+ PendingReady *readyOp = nullptr;
if (props.contains(QLatin1String("Account"))) {
QDBusObjectPath accountObjectPath =
@@ -225,7 +225,11 @@ void ChannelRequest::Private::extractMainProps(const QVariantMap &props, bool la
// FIXME See http://bugs.freedesktop.org/show_bug.cgi?id=21690
uint stamp = (uint) qdbus_cast<qlonglong>(props.value(QLatin1String("UserActionTime")));
if (stamp != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime = QDateTime::fromTime_t(stamp);
+#else
+ userActionTime = QDateTime::fromSecsSinceEpoch(stamp);
+#endif
}
preferredHandler = qdbus_cast<QString>(props.value(QLatin1String("PreferredHandler")));
@@ -286,6 +290,7 @@ const Feature ChannelRequest::FeatureCore = Feature(QLatin1String(ChannelRequest
/**
* Create a new channel request object using the given \a bus and the given factories.
*
+ * \param bus QDBusConnection to use.
* \param objectPath The channel request object path.
* \param immutableProperties The channel request immutable properties.
* \param accountFactory The account factory to use.
@@ -504,7 +509,11 @@ QVariantMap ChannelRequest::immutableProperties() const
if (userActionTime().isValid()) {
props.insert(TP_QT_IFACE_CHANNEL_REQUEST + QLatin1String(".UserActionTime"),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QVariant::fromValue(userActionTime().toTime_t()));
+#else
+ QVariant::fromValue(userActionTime().toSecsSinceEpoch()));
+#endif
}
if (!preferredHandler().isNull()) {
@@ -746,7 +755,7 @@ ChannelRequestHints &ChannelRequestHints::operator=(const ChannelRequestHints &o
bool ChannelRequestHints::isValid() const
{
- return mPriv.constData() != 0;
+ return mPriv.constData() != nullptr;
}
bool ChannelRequestHints::hasHint(const QString &reversedDomain, const QString &localName) const
diff --git a/TelepathyQt/channel-request.h b/TelepathyQt/channel-request.h
index c0eb7b2b..f1b0acde 100644
--- a/TelepathyQt/channel-request.h
+++ b/TelepathyQt/channel-request.h
@@ -68,7 +68,7 @@ public:
static ChannelRequestPtr create(const AccountPtr &account,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~ChannelRequest();
+ ~ChannelRequest() override;
AccountPtr account() const;
QDateTime userActionTime() const;
@@ -144,6 +144,6 @@ private:
} // Tp
-Q_DECLARE_METATYPE(Tp::ChannelRequestHints);
+Q_DECLARE_METATYPE(Tp::ChannelRequestHints)
#endif
diff --git a/TelepathyQt/channel.cpp b/TelepathyQt/channel.cpp
index bf3a1d87..b5849f6e 100644
--- a/TelepathyQt/channel.cpp
+++ b/TelepathyQt/channel.cpp
@@ -266,8 +266,8 @@ Channel::Private::Private(Channel *parent, const ConnectionPtr &connection,
properties(parent->interface<Client::DBus::PropertiesInterface>()),
connection(connection),
immutableProperties(immutableProperties),
- group(0),
- conference(0),
+ group(nullptr),
+ conference(nullptr),
readinessHelper(parent->readinessHelper()),
targetHandleType(0),
targetHandle(0),
@@ -277,7 +277,7 @@ Channel::Private::Private(Channel *parent, const ConnectionPtr &connection,
usingMembersChangedDetailed(false),
groupHaveMembers(false),
buildingContacts(false),
- currentGroupMembersChangedInfo(0),
+ currentGroupMembersChangedInfo(nullptr),
groupAreHandleOwnersAvailable(false),
pendingRetrieveGroupSelfContact(false),
groupIsSelfHandleTracked(false),
@@ -353,7 +353,6 @@ void Channel::Private::introspectMain(Channel::Private *self)
void Channel::Private::introspectMainProperties()
{
QVariantMap props;
- QString key;
bool needIntrospectMainProps = false;
const unsigned numNames = 8;
const static QString names[numNames] = {
@@ -442,11 +441,11 @@ void Channel::Private::introspectMainFallbackInterfaces()
void Channel::Private::introspectGroup()
{
- Q_ASSERT(properties != 0);
+ Q_ASSERT(properties != nullptr);
if (!group) {
group = parent->interface<Client::ChannelInterfaceGroupInterface>();
- Q_ASSERT(group != 0);
+ Q_ASSERT(group != nullptr);
}
debug() << "Introspecting Channel.Interface.Group for" << parent->objectPath();
@@ -492,7 +491,7 @@ void Channel::Private::introspectGroup()
void Channel::Private::introspectGroupFallbackFlags()
{
- Q_ASSERT(group != 0);
+ Q_ASSERT(group != nullptr);
debug() << "Calling Channel.Interface.Group::GetGroupFlags()";
QDBusPendingCallWatcher *watcher =
@@ -504,7 +503,7 @@ void Channel::Private::introspectGroupFallbackFlags()
void Channel::Private::introspectGroupFallbackMembers()
{
- Q_ASSERT(group != 0);
+ Q_ASSERT(group != nullptr);
debug() << "Calling Channel.Interface.Group::GetAllMembers()";
QDBusPendingCallWatcher *watcher =
@@ -516,7 +515,7 @@ void Channel::Private::introspectGroupFallbackMembers()
void Channel::Private::introspectGroupFallbackLocalPendingWithInfo()
{
- Q_ASSERT(group != 0);
+ Q_ASSERT(group != nullptr);
debug() << "Calling Channel.Interface.Group::GetLocalPendingMembersWithInfo()";
QDBusPendingCallWatcher *watcher =
@@ -529,7 +528,7 @@ void Channel::Private::introspectGroupFallbackLocalPendingWithInfo()
void Channel::Private::introspectGroupFallbackSelfHandle()
{
- Q_ASSERT(group != 0);
+ Q_ASSERT(group != nullptr);
debug() << "Calling Channel.Interface.Group::GetSelfHandle()";
QDBusPendingCallWatcher *watcher =
@@ -541,12 +540,12 @@ void Channel::Private::introspectGroupFallbackSelfHandle()
void Channel::Private::introspectConference()
{
- Q_ASSERT(properties != 0);
- Q_ASSERT(conference == 0);
+ Q_ASSERT(properties != nullptr);
+ Q_ASSERT(conference == nullptr);
debug() << "Introspecting Conference interface";
conference = parent->interface<Client::ChannelInterfaceConferenceInterface>();
- Q_ASSERT(conference != 0);
+ Q_ASSERT(conference != nullptr);
introspectingConference = true;
@@ -1100,7 +1099,7 @@ void Channel::Private::updateContacts(const QList<ContactPtr> &contacts)
}
}
delete currentGroupMembersChangedInfo;
- currentGroupMembersChangedInfo = 0;
+ currentGroupMembersChangedInfo = nullptr;
if (selfContactUpdated && parent->isReady(Channel::FeatureCore)) {
emit parent->groupSelfContactChanged();
@@ -1237,7 +1236,7 @@ void Channel::Private::processConferenceChannelRemoved()
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(gotConferenceChannelRemovedActorContact(Tp::PendingOperation*)));
} else {
- parent->gotConferenceChannelRemovedActorContact(0);
+ parent->gotConferenceChannelRemovedActorContact(nullptr);
}
}
@@ -1836,7 +1835,7 @@ Channel::PendingLeave::PendingLeave(const ChannelPtr &chan, const QString &messa
ChannelGroupChangeReason reason)
: PendingOperation(chan)
{
- Q_ASSERT(chan->mPriv->group != NULL);
+ Q_ASSERT(chan->mPriv->group != nullptr);
QDBusPendingCall call =
chan->mPriv->group->RemoveMembersWithReason(
diff --git a/TelepathyQt/channel.h b/TelepathyQt/channel.h
index 8103a24a..61bd94f2 100644
--- a/TelepathyQt/channel.h
+++ b/TelepathyQt/channel.h
@@ -61,7 +61,7 @@ public:
static ChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~Channel();
+ ~Channel() override;
ConnectionPtr connection() const;
@@ -111,7 +111,7 @@ public:
GroupMemberChangeDetails &operator=(const GroupMemberChangeDetails &other);
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
bool hasActor() const;
ContactPtr actor() const;
@@ -247,6 +247,6 @@ private:
} // Tp
-Q_DECLARE_METATYPE(Tp::Channel::GroupMemberChangeDetails);
+Q_DECLARE_METATYPE(Tp::Channel::GroupMemberChangeDetails)
#endif
diff --git a/TelepathyQt/client-registrar-internal.h b/TelepathyQt/client-registrar-internal.h
index 3f0b4ec3..daaf9fb5 100644
--- a/TelepathyQt/client-registrar-internal.h
+++ b/TelepathyQt/client-registrar-internal.h
@@ -52,7 +52,7 @@ class TP_QT_NO_EXPORT ClientAdaptor : public QDBusAbstractAdaptor
public:
ClientAdaptor(ClientRegistrar *registrar, const QStringList &interfaces, QObject *parent);
- virtual ~ClientAdaptor();
+ ~ClientAdaptor() override;
inline const ClientRegistrar *registrar() const
{
@@ -96,7 +96,7 @@ public:
ClientObserverAdaptor(ClientRegistrar *registrar,
AbstractClientObserver *client,
QObject *parent);
- virtual ~ClientObserverAdaptor();
+ ~ClientObserverAdaptor() override;
inline const ClientRegistrar *registrar() const
{
@@ -129,7 +129,7 @@ private Q_SLOTS:
private:
struct InvocationData : RefCounted
{
- InvocationData() : readyOp(0) {}
+ InvocationData() : readyOp(nullptr) {}
PendingOperation *readyOp;
QString error, message;
@@ -170,7 +170,7 @@ public:
ClientApproverAdaptor(ClientRegistrar *registrar,
AbstractClientApprover *client,
QObject *parent);
- virtual ~ClientApproverAdaptor();
+ ~ClientApproverAdaptor() override;
inline const ClientRegistrar *registrar() const
{
@@ -195,7 +195,7 @@ private Q_SLOTS:
private:
struct InvocationData : RefCounted
{
- InvocationData() : readyOp(0) {}
+ InvocationData() : readyOp(nullptr) {}
PendingOperation *readyOp;
QString error, message;
@@ -242,7 +242,7 @@ public:
ClientHandlerAdaptor(ClientRegistrar *registrar,
AbstractClientHandler *client,
QObject *parent);
- virtual ~ClientHandlerAdaptor();
+ ~ClientHandlerAdaptor() override;
inline const ClientRegistrar *registrar() const
{
@@ -285,7 +285,7 @@ private Q_SLOTS:
private:
struct InvocationData : RefCounted
{
- InvocationData() : readyOp(0) {}
+ InvocationData() : readyOp(nullptr) {}
PendingOperation *readyOp;
QString error, message;
@@ -333,7 +333,7 @@ public:
ClientHandlerRequestsAdaptor(ClientRegistrar *registrar,
AbstractClientHandler *client,
QObject *parent);
- virtual ~ClientHandlerRequestsAdaptor();
+ ~ClientHandlerRequestsAdaptor() override;
inline const ClientRegistrar *registrar() const
{
diff --git a/TelepathyQt/client-registrar.cpp b/TelepathyQt/client-registrar.cpp
index 6ed99328..4f8ac3b1 100644
--- a/TelepathyQt/client-registrar.cpp
+++ b/TelepathyQt/client-registrar.cpp
@@ -72,7 +72,7 @@ private:
{
}
- void onFinished()
+ void onFinished() override
{
if (mFinishedCb) {
mFinishedCb(MethodInvocationContextPtr<>(this), mChannels, mFinishedCbData);
@@ -193,6 +193,12 @@ void ClientObserverAdaptor::ObserveChannels(const QDBusObjectPath &accountPath,
ObjectImmutablePropertiesMap reqPropsMap = qdbus_cast<ObjectImmutablePropertiesMap>(
observerInfo.value(QLatin1String("request-properties")));
foreach (const QDBusObjectPath &reqPath, requestsSatisfied) {
+ //don't load the channelRequest objects in requestsSatisfied if the properties are not supplied with the handler info
+ //as the channelRequest is probably invalid
+ //this works around https://bugs.freedesktop.org/show_bug.cgi?id=77986
+ if (reqPropsMap.value(reqPath).isEmpty()) {
+ continue;
+ }
ChannelRequestPtr channelRequest = ChannelRequest::create(invocation->acc,
reqPath.path(), reqPropsMap.value(reqPath));
invocation->chanReqs.append(channelRequest);
@@ -223,7 +229,7 @@ void ClientObserverAdaptor::onReadyOpFinished(Tp::PendingOperation *op)
continue;
}
- (*i)->readyOp = 0;
+ (*i)->readyOp = nullptr;
if (op->isError()) {
warning() << "Preparing proxies for ObserveChannels failed with" << op->errorName()
@@ -326,7 +332,7 @@ void ClientApproverAdaptor::onReadyOpFinished(Tp::PendingOperation *op)
continue;
}
- (*i)->readyOp = 0;
+ (*i)->readyOp = nullptr;
if (op->isError()) {
warning() << "Preparing proxies for AddDispatchOperation failed with" << op->errorName()
@@ -435,6 +441,12 @@ void ClientHandlerAdaptor::HandleChannels(const QDBusObjectPath &accountPath,
ObjectImmutablePropertiesMap reqPropsMap = qdbus_cast<ObjectImmutablePropertiesMap>(
handlerInfo.value(QLatin1String("request-properties")));
foreach (const QDBusObjectPath &reqPath, requestsSatisfied) {
+ //don't load the channelRequest objects in requestsSatisfied if the properties are not supplied with the handler info
+ //as the channelRequest is probably invalid
+ //this works around https://bugs.freedesktop.org/show_bug.cgi?id=77986
+ if (reqPropsMap.value(reqPath).isEmpty()) {
+ continue;
+ }
ChannelRequestPtr channelRequest = ChannelRequest::create(invocation->acc,
reqPath.path(), reqPropsMap.value(reqPath));
invocation->chanReqs.append(channelRequest);
@@ -443,7 +455,11 @@ void ClientHandlerAdaptor::HandleChannels(const QDBusObjectPath &accountPath,
// FIXME See http://bugs.freedesktop.org/show_bug.cgi?id=21690
if (userActionTime_t != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
invocation->time = QDateTime::fromTime_t((uint) userActionTime_t);
+#else
+ invocation->time = QDateTime::fromSecsSinceEpoch((uint) userActionTime_t);
+#endif
}
invocation->ctx = HandleChannelsInvocationContext::create(mBus, message,
@@ -474,7 +490,7 @@ void ClientHandlerAdaptor::onReadyOpFinished(Tp::PendingOperation *op)
continue;
}
- (*i)->readyOp = 0;
+ (*i)->readyOp = nullptr;
if (op->isError()) {
warning() << "Preparing proxies for HandleChannels failed with" << op->errorName()
@@ -891,8 +907,7 @@ bool ClientRegistrar::registerClient(const AbstractClientPtr &client,
.arg((quintptr) client.data(), 0, 16));
}
- if (mPriv->services.contains(busName) ||
- !mPriv->bus.registerService(busName)) {
+ if (mPriv->services.contains(busName)) {
warning() << "Unable to register client: busName" <<
busName << "already registered";
return false;
@@ -938,7 +953,6 @@ bool ClientRegistrar::registerClient(const AbstractClientPtr &client,
if (interfaces.isEmpty()) {
warning() << "Client does not implement any known interface";
// cleanup
- mPriv->bus.unregisterService(busName);
return false;
}
@@ -953,10 +967,18 @@ bool ClientRegistrar::registerClient(const AbstractClientPtr &client,
objectPath << "already registered";
// cleanup
delete object;
- mPriv->bus.unregisterService(busName);
return false;
}
+ if (!mPriv->bus.registerService(busName)) {
+ warning() << "Unable to register service: busName" <<
+ busName << "already registered";
+ mPriv->bus.unregisterObject(objectPath, QDBusConnection::UnregisterTree);
+ delete object;
+ return false;
+ }
+
+
if (handler) {
handler->setRegistered(true);
}
diff --git a/TelepathyQt/client-registrar.h b/TelepathyQt/client-registrar.h
index 631dd454..9af4f8fb 100644
--- a/TelepathyQt/client-registrar.h
+++ b/TelepathyQt/client-registrar.h
@@ -63,7 +63,7 @@ public:
const ContactFactoryConstPtr &contactFactory);
static ClientRegistrarPtr create(const AccountManagerPtr &accountManager);
- ~ClientRegistrar();
+ ~ClientRegistrar() override;
QDBusConnection dbusConnection() const;
diff --git a/TelepathyQt/connection-capabilities.h b/TelepathyQt/connection-capabilities.h
index 1c9bf1a5..deba0d79 100644
--- a/TelepathyQt/connection-capabilities.h
+++ b/TelepathyQt/connection-capabilities.h
@@ -39,7 +39,7 @@ class TP_QT_EXPORT ConnectionCapabilities : public CapabilitiesBase
{
public:
ConnectionCapabilities();
- virtual ~ConnectionCapabilities();
+ ~ConnectionCapabilities() override;
bool textChatrooms() const;
@@ -69,6 +69,6 @@ protected:
} // Tp
-Q_DECLARE_METATYPE(Tp::ConnectionCapabilities);
+Q_DECLARE_METATYPE(Tp::ConnectionCapabilities)
#endif
diff --git a/TelepathyQt/connection-factory.h b/TelepathyQt/connection-factory.h
index 70f3b503..c434c33c 100644
--- a/TelepathyQt/connection-factory.h
+++ b/TelepathyQt/connection-factory.h
@@ -52,7 +52,7 @@ public:
static ConnectionFactoryPtr create(const QDBusConnection &bus,
const Features &features = Features());
- virtual ~ConnectionFactory();
+ ~ConnectionFactory() override;
PendingReady *proxy(const QString &busName, const QString &objectPath,
const ChannelFactoryConstPtr &chanFactory,
@@ -64,7 +64,7 @@ protected:
virtual ConnectionPtr construct(const QString &busName, const QString &objectPath,
const ChannelFactoryConstPtr &chanFactory,
const ContactFactoryConstPtr &contactFactory) const;
- virtual QString finalBusNameFrom(const QString &uniqueOrWellKnown) const;
+ QString finalBusNameFrom(const QString &uniqueOrWellKnown) const override;
// Nothing we'd like to prepare()
// Fixed features
diff --git a/TelepathyQt/connection-lowlevel.h b/TelepathyQt/connection-lowlevel.h
index 63a3429f..536985e8 100644
--- a/TelepathyQt/connection-lowlevel.h
+++ b/TelepathyQt/connection-lowlevel.h
@@ -46,7 +46,7 @@ class TP_QT_EXPORT ConnectionLowlevel : public QObject, public RefCounted
Q_DISABLE_COPY(ConnectionLowlevel)
public:
- ~ConnectionLowlevel();
+ ~ConnectionLowlevel() override;
bool isValid() const;
ConnectionPtr connection() const;
diff --git a/TelepathyQt/connection-manager-internal.h b/TelepathyQt/connection-manager-internal.h
index 952a748d..c0fe2c3b 100644
--- a/TelepathyQt/connection-manager-internal.h
+++ b/TelepathyQt/connection-manager-internal.h
@@ -97,7 +97,7 @@ class TP_QT_NO_EXPORT ConnectionManager::Private::PendingNames : public PendingS
public:
PendingNames(const QDBusConnection &bus);
- ~PendingNames() {};
+ ~PendingNames() override {};
private Q_SLOTS:
void onCallFinished(QDBusPendingCallWatcher *);
@@ -123,7 +123,7 @@ public:
ProtocolWrapper(const ConnectionManagerPtr &cm,
const QString &objectPath,
const QString &name, const QVariantMap &props);
- ~ProtocolWrapper();
+ ~ProtocolWrapper() override;
ProtocolInfo info() const { return mInfo; }
diff --git a/TelepathyQt/connection-manager-lowlevel.h b/TelepathyQt/connection-manager-lowlevel.h
index 69c67330..f0286c64 100644
--- a/TelepathyQt/connection-manager-lowlevel.h
+++ b/TelepathyQt/connection-manager-lowlevel.h
@@ -41,7 +41,7 @@ class TP_QT_EXPORT ConnectionManagerLowlevel : public QObject, public RefCounted
Q_DISABLE_COPY(ConnectionManagerLowlevel)
public:
- ~ConnectionManagerLowlevel();
+ ~ConnectionManagerLowlevel() override;
bool isValid() const;
ConnectionManagerPtr connectionManager() const;
diff --git a/TelepathyQt/connection-manager.cpp b/TelepathyQt/connection-manager.cpp
index e6e32e0d..c99b9af5 100644
--- a/TelepathyQt/connection-manager.cpp
+++ b/TelepathyQt/connection-manager.cpp
@@ -167,7 +167,7 @@ void ConnectionManager::Private::ProtocolWrapper::introspectMain(
void ConnectionManager::Private::ProtocolWrapper::introspectMainProperties()
{
Client::ProtocolInterface *protocol = baseInterface();
- Q_ASSERT(protocol != 0);
+ Q_ASSERT(protocol != nullptr);
debug() << "Calling Properties::GetAll(Protocol) for" << info().name();
PendingVariantMap *pvm = protocol->requestAllProperties();
@@ -206,7 +206,7 @@ void ConnectionManager::Private::ProtocolWrapper::introspectInterfaces()
void ConnectionManager::Private::ProtocolWrapper::introspectAvatars()
{
Client::ProtocolInterfaceAvatarsInterface *avatars = avatarsInterface();
- Q_ASSERT(avatars != 0);
+ Q_ASSERT(avatars != nullptr);
debug() << "Calling Properties::GetAll(Protocol.Avatars) for" << info().name();
PendingVariantMap *pvm = avatars->requestAllProperties();
@@ -218,7 +218,7 @@ void ConnectionManager::Private::ProtocolWrapper::introspectAvatars()
void ConnectionManager::Private::ProtocolWrapper::introspectPresence()
{
Client::ProtocolInterfacePresenceInterface *presence = presenceInterface();
- Q_ASSERT(presence != 0);
+ Q_ASSERT(presence != nullptr);
debug() << "Calling Properties::GetAll(Protocol.Presence) for" << info().name();
PendingVariantMap *pvm = presence->requestAllProperties();
@@ -230,7 +230,7 @@ void ConnectionManager::Private::ProtocolWrapper::introspectPresence()
void ConnectionManager::Private::ProtocolWrapper::introspectAddressing()
{
Client::ProtocolInterfaceAddressingInterface *addressing = addressingInterface();
- Q_ASSERT(addressing != 0);
+ Q_ASSERT(addressing != nullptr);
debug() << "Calling Properties::GetAll(Protocol.Addressing) for" << info().name();
PendingVariantMap *pvm = addressing->requestAllProperties();
@@ -769,6 +769,9 @@ ConnectionManagerPtr ConnectionManager::create(const QDBusConnection &bus,
*
* \param bus QDBusConnection to use.
* \param name Name of the connection manager.
+ * \param connectionFactory The connection factory to use.
+ * \param channelFactory The channel factory to use.
+ * \param contactFactory The contact factory to use.
*/
ConnectionManager::ConnectionManager(const QDBusConnection &bus,
const QString &name,
diff --git a/TelepathyQt/connection-manager.h b/TelepathyQt/connection-manager.h
index 598535ba..56d4fd45 100644
--- a/TelepathyQt/connection-manager.h
+++ b/TelepathyQt/connection-manager.h
@@ -77,7 +77,7 @@ public:
const ContactFactoryConstPtr &contactFactory =
ContactFactory::create());
- virtual ~ConnectionManager();
+ ~ConnectionManager() override;
QString name() const;
diff --git a/TelepathyQt/connection.cpp b/TelepathyQt/connection.cpp
index aa744331..7e16c558 100644
--- a/TelepathyQt/connection.cpp
+++ b/TelepathyQt/connection.cpp
@@ -201,7 +201,7 @@ Connection::Private::Private(Connection *parent,
contactFactory(contactFactory),
baseInterface(new Client::ConnectionInterface(parent)),
properties(parent->interface<Client::DBus::PropertiesInterface>()),
- simplePresence(0),
+ simplePresence(nullptr),
readinessHelper(parent->readinessHelper()),
introspectingConnected(false),
pendingStatus((uint) -1),
@@ -214,12 +214,12 @@ Connection::Private::Private(Connection *parent,
introspectingSelfContact(false),
reintrospectSelfContactRequired(false),
maxPresenceStatusMessageLength(0),
- handleContext(0)
+ handleContext(nullptr)
{
accountBalance.amount = 0;
accountBalance.scale = 0;
- Q_ASSERT(properties != 0);
+ Q_ASSERT(properties != nullptr);
if (chanFactory->dbusConnection().name() != parent->dbusConnection().name()) {
warning() << " The D-Bus connection in the channel factory is not the proxy connection";
@@ -489,7 +489,7 @@ void Connection::Private::introspectSelfContact(Connection::Private *self)
void Connection::Private::introspectSimplePresence(Connection::Private *self)
{
- Q_ASSERT(self->properties != 0);
+ Q_ASSERT(self->properties != nullptr);
debug() << "Calling Properties::Get("
"Connection.I.SimplePresence.Statuses)";
@@ -1149,7 +1149,7 @@ struct TP_QT_NO_EXPORT Connection::ErrorDetails::Private : public QSharedData
* Constructs a new invalid ErrorDetails instance.
*/
Connection::ErrorDetails::ErrorDetails()
- : mPriv(0)
+ : mPriv(nullptr)
{
}
diff --git a/TelepathyQt/connection.h b/TelepathyQt/connection.h
index 0ca47a53..1f8d899a 100644
--- a/TelepathyQt/connection.h
+++ b/TelepathyQt/connection.h
@@ -51,7 +51,6 @@ namespace Tp
class Channel;
class ConnectionCapabilities;
class ConnectionLowlevel;
-class Contact;
class ContactManager;
class PendingChannel;
class PendingContactAttributes;
@@ -83,7 +82,7 @@ public:
const ChannelFactoryConstPtr &channelFactory,
const ContactFactoryConstPtr &contactFactory);
- virtual ~Connection();
+ ~Connection() override;
ChannelFactoryConstPtr channelFactory() const;
ContactFactoryConstPtr contactFactory() const;
@@ -104,7 +103,7 @@ public:
ErrorDetails &operator=(const ErrorDetails &other);
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
bool hasDebugMessage() const
{
@@ -244,6 +243,6 @@ private:
} // Tp
-Q_DECLARE_METATYPE(Tp::Connection::ErrorDetails);
+Q_DECLARE_METATYPE(Tp::Connection::ErrorDetails)
#endif
diff --git a/TelepathyQt/contact-capabilities.h b/TelepathyQt/contact-capabilities.h
index d2c0f672..be232a9a 100644
--- a/TelepathyQt/contact-capabilities.h
+++ b/TelepathyQt/contact-capabilities.h
@@ -39,7 +39,7 @@ class TP_QT_EXPORT ContactCapabilities : public CapabilitiesBase
{
public:
ContactCapabilities();
- virtual ~ContactCapabilities();
+ ~ContactCapabilities() override;
bool dbusTubes(const QString &serviceName) const;
QStringList dbusTubeServices() const;
@@ -64,6 +64,6 @@ protected:
} // Tp
-Q_DECLARE_METATYPE(Tp::ContactCapabilities);
+Q_DECLARE_METATYPE(Tp::ContactCapabilities)
#endif
diff --git a/TelepathyQt/contact-factory.cpp b/TelepathyQt/contact-factory.cpp
index cd93acde..5d7253e9 100644
--- a/TelepathyQt/contact-factory.cpp
+++ b/TelepathyQt/contact-factory.cpp
@@ -140,7 +140,7 @@ ContactPtr ContactFactory::construct(Tp::ContactManager *manager, const Referenc
*/
PendingOperation *ContactFactory::prepare(const ContactPtr &contact) const
{
- return NULL;
+ return nullptr;
}
}
diff --git a/TelepathyQt/contact-factory.h b/TelepathyQt/contact-factory.h
index d8355f2a..c8a48706 100644
--- a/TelepathyQt/contact-factory.h
+++ b/TelepathyQt/contact-factory.h
@@ -48,7 +48,7 @@ class TP_QT_EXPORT ContactFactory : public RefCounted
public:
static ContactFactoryPtr create(const Features &features = Features());
- virtual ~ContactFactory();
+ ~ContactFactory() override;
Features features() const;
diff --git a/TelepathyQt/contact-manager-internal.h b/TelepathyQt/contact-manager-internal.h
index 96329645..44ae8aa2 100644
--- a/TelepathyQt/contact-manager-internal.h
+++ b/TelepathyQt/contact-manager-internal.h
@@ -43,7 +43,7 @@ class TP_QT_NO_EXPORT ContactManager::Roster : public QObject
public:
Roster(ContactManager *manager);
- virtual ~Roster();
+ ~Roster() override;
ContactListState state() const;
@@ -341,7 +341,7 @@ class TP_QT_NO_EXPORT ContactManager::Roster::ModifyFinishOp : public PendingOpe
public:
ModifyFinishOp(const ConnectionPtr &conn);
- ~ModifyFinishOp() {};
+ ~ModifyFinishOp() override {};
void setError(const QString &errorName, const QString &errorMessage);
void finish();
@@ -356,7 +356,7 @@ class TP_QT_NO_EXPORT ContactManager::Roster::RemoveGroupOp : public PendingOper
public:
RemoveGroupOp(const ChannelPtr &channel);
- ~RemoveGroupOp() {};
+ ~RemoveGroupOp() override {};
private Q_SLOTS:
void onContactsRemoved(Tp::PendingOperation *);
@@ -369,7 +369,7 @@ class TP_QT_NO_EXPORT ContactManager::PendingRefreshContactInfo : public Pending
public:
PendingRefreshContactInfo(const ConnectionPtr &conn);
- ~PendingRefreshContactInfo();
+ ~PendingRefreshContactInfo() override;
void addContact(Contact *contact);
diff --git a/TelepathyQt/contact-manager-roster.cpp b/TelepathyQt/contact-manager-roster.cpp
index db45ca1a..6322ee59 100644
--- a/TelepathyQt/contact-manager-roster.cpp
+++ b/TelepathyQt/contact-manager-roster.cpp
@@ -46,8 +46,8 @@ ContactManager::Roster::Roster(ContactManager *contactManager)
contactManager(contactManager),
usingFallbackContactList(false),
hasContactBlockingInterface(false),
- introspectPendingOp(0),
- introspectGroupsPendingOp(0),
+ introspectPendingOp(nullptr),
+ introspectGroupsPendingOp(nullptr),
pendingContactListState((uint) -1),
contactListState((uint) -1),
canReportAbusive(false),
@@ -198,7 +198,7 @@ PendingOperation *ContactManager::Roster::introspectGroups()
}
if (groupsReintrospectionRequired) {
- return NULL;
+ return nullptr;
}
Q_ASSERT(!introspectGroupsPendingOp);
@@ -771,7 +771,7 @@ void ContactManager::Roster::gotContactListProperties(PendingOperation *op)
if (introspectPendingOp) {
introspectPendingOp->setFinishedWithError(
op->errorName(), op->errorMessage());
- introspectPendingOp = 0;
+ introspectPendingOp = nullptr;
}
return;
}
@@ -807,7 +807,7 @@ void ContactManager::Roster::gotContactListContacts(QDBusPendingCallWatcher *wat
if (introspectPendingOp) {
introspectPendingOp->setFinishedWithError(
reply.error());
- introspectPendingOp = 0;
+ introspectPendingOp = nullptr;
}
return;
}
@@ -831,8 +831,9 @@ void ContactManager::Roster::gotContactListContacts(QDBusPendingCallWatcher *wat
contactListContacts.insert(contact);
}
- if (contactManager->connection()->requestedFeatures().contains(
- Connection::FeatureRosterGroups)) {
+ const bool groupsRequested = conn->requestedFeatures().contains(Connection::FeatureRosterGroups);
+ const bool groupsSupported = conn->hasInterface(TP_QT_IFACE_CONNECTION_INTERFACE_CONTACT_GROUPS);
+ if (groupsRequested && groupsSupported) {
groupsSetSuccess = true;
}
@@ -850,7 +851,7 @@ void ContactManager::Roster::gotContactListContacts(QDBusPendingCallWatcher *wat
}
introspectPendingOp->setFinished();
- introspectPendingOp = 0;
+ introspectPendingOp = nullptr;
} else if (!groupsSetSuccess) {
setStateSuccess();
} else {
@@ -900,7 +901,7 @@ void ContactManager::Roster::onContactListStateChanged(uint state)
// case the contacts will appear.
Q_ASSERT(introspectPendingOp);
introspectPendingOp->setFinished();
- introspectPendingOp = 0;
+ introspectPendingOp = nullptr;
}
}
@@ -1270,7 +1271,7 @@ void ContactManager::Roster::onContactListChannelReady()
Q_ASSERT(introspectPendingOp);
introspectPendingOp->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED,
QLatin1String("Roster not supported"));
- introspectPendingOp = 0;
+ introspectPendingOp = nullptr;
return;
}
@@ -1306,13 +1307,13 @@ void ContactManager::Roster::onContactListChannelReady()
}
introspectPendingOp->setFinished();
- introspectPendingOp = 0;
+ introspectPendingOp = nullptr;
}
}
void ContactManager::Roster::gotContactListGroupsProperties(PendingOperation *op)
{
- Q_ASSERT(introspectGroupsPendingOp != NULL);
+ Q_ASSERT(introspectGroupsPendingOp != nullptr);
if (groupsSetSuccess) {
// Connect here, so we catch the following and the other failure cases
@@ -1327,7 +1328,7 @@ void ContactManager::Roster::gotContactListGroupsProperties(PendingOperation *op
introspectGroupsPendingOp->setFinishedWithError(
op->errorName(), op->errorMessage());
- introspectGroupsPendingOp = 0;
+ introspectGroupsPendingOp = nullptr;
return;
}
@@ -1354,7 +1355,7 @@ void ContactManager::Roster::onContactListContactsUpgraded(PendingOperation *op)
Q_ASSERT(processingContactListChanges);
processingContactListChanges = false;
- Q_ASSERT(introspectGroupsPendingOp != NULL);
+ Q_ASSERT(introspectGroupsPendingOp != nullptr);
if (op->isError()) {
warning() << "Upgrading contacts with group membership failed:" << op->errorName() << '-'
@@ -1362,13 +1363,13 @@ void ContactManager::Roster::onContactListContactsUpgraded(PendingOperation *op)
introspectGroupsPendingOp->setFinishedWithError(
op->errorName(), op->errorMessage());
- introspectGroupsPendingOp = 0;
+ introspectGroupsPendingOp = nullptr;
processContactListChanges();
return;
}
introspectGroupsPendingOp->setFinished();
- introspectGroupsPendingOp = 0;
+ introspectGroupsPendingOp = nullptr;
processContactListChanges();
}
@@ -1608,7 +1609,7 @@ void ContactManager::Roster::onContactListGroupRemoved(Tp::DBusProxy *proxy,
TP_QT_IFACE_CHANNEL + QLatin1String(".TargetID")).toString();
contactListGroupChannels.remove(id);
removedContactListGroupChannels.append(contactListGroupChannel);
- disconnect(contactListGroupChannel.data(), 0, 0, 0);
+ disconnect(contactListGroupChannel.data(), nullptr, nullptr, nullptr);
emit contactManager->groupRemoved(id);
}
@@ -2068,7 +2069,7 @@ void ContactManager::Roster::checkContactListGroupsReady()
setContactListGroupChannelsReady();
if (introspectGroupsPendingOp) {
introspectGroupsPendingOp->setFinished();
- introspectGroupsPendingOp = 0;
+ introspectGroupsPendingOp = nullptr;
}
pendingContactListGroupChannels.clear();
}
diff --git a/TelepathyQt/contact-manager.cpp b/TelepathyQt/contact-manager.cpp
index dfa28bce..a876e32c 100644
--- a/TelepathyQt/contact-manager.cpp
+++ b/TelepathyQt/contact-manager.cpp
@@ -79,7 +79,7 @@ ContactManager::Private::Private(ContactManager *parent, Connection *connection)
connection(connection),
roster(new ContactManager::Roster(parent)),
requestAvatarsIdle(false),
- refreshInfoOp(0)
+ refreshInfoOp(nullptr)
{
}
@@ -1434,7 +1434,7 @@ void ContactManager::doRefreshInfo()
{
PendingRefreshContactInfo *op = mPriv->refreshInfoOp;
Q_ASSERT(op);
- mPriv->refreshInfoOp = 0;
+ mPriv->refreshInfoOp = nullptr;
op->refreshInfo();
}
diff --git a/TelepathyQt/contact-manager.h b/TelepathyQt/contact-manager.h
index 3d703bc2..c6aff876 100644
--- a/TelepathyQt/contact-manager.h
+++ b/TelepathyQt/contact-manager.h
@@ -53,7 +53,7 @@ class TP_QT_EXPORT ContactManager : public Object
Q_DISABLE_COPY(ContactManager)
public:
- virtual ~ContactManager();
+ ~ContactManager() override;
ConnectionPtr connection() const;
diff --git a/TelepathyQt/contact-messenger.cpp b/TelepathyQt/contact-messenger.cpp
index 1f34f4bd..2c13a845 100644
--- a/TelepathyQt/contact-messenger.cpp
+++ b/TelepathyQt/contact-messenger.cpp
@@ -45,7 +45,7 @@ struct TP_QT_NO_EXPORT ContactMessenger::Private
: parent(parent),
account(account),
contactIdentifier(contactIdentifier),
- cdMessagesInterface(0)
+ cdMessagesInterface(nullptr)
{
}
diff --git a/TelepathyQt/contact-messenger.h b/TelepathyQt/contact-messenger.h
index 41b93b87..1b01530c 100644
--- a/TelepathyQt/contact-messenger.h
+++ b/TelepathyQt/contact-messenger.h
@@ -46,7 +46,7 @@ public:
static ContactMessengerPtr create(const AccountPtr &account, const ContactPtr &contact);
static ContactMessengerPtr create(const AccountPtr &account, const QString &contactIdentifier);
- virtual ~ContactMessenger();
+ ~ContactMessenger() override;
AccountPtr account() const;
QString contactIdentifier() const;
@@ -55,9 +55,9 @@ public:
PendingSendMessage *sendMessage(const QString &text,
ChannelTextMessageType type = ChannelTextMessageTypeNormal,
- MessageSendingFlags flags = 0);
+ MessageSendingFlags flags = nullptr);
PendingSendMessage *sendMessage(const MessageContentPartList &parts,
- MessageSendingFlags flags = 0);
+ MessageSendingFlags flags = nullptr);
Q_SIGNALS:
void messageSent(const Tp::Message &message, Tp::MessageSendingFlags flags,
diff --git a/TelepathyQt/contact-search-channel.h b/TelepathyQt/contact-search-channel.h
index 29c8424c..e42673f2 100644
--- a/TelepathyQt/contact-search-channel.h
+++ b/TelepathyQt/contact-search-channel.h
@@ -49,7 +49,7 @@ public:
SearchStateChangeDetails(const SearchStateChangeDetails &other);
~SearchStateChangeDetails();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
SearchStateChangeDetails &operator=(const SearchStateChangeDetails &other);
@@ -73,7 +73,7 @@ public:
static ContactSearchChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~ContactSearchChannel();
+ ~ContactSearchChannel() override;
ChannelContactSearchState searchState() const;
uint limit() const;
diff --git a/TelepathyQt/contact.cpp b/TelepathyQt/contact.cpp
index 8f28061d..d244d645 100644
--- a/TelepathyQt/contact.cpp
+++ b/TelepathyQt/contact.cpp
@@ -1371,7 +1371,7 @@ void Contact::setRemovedFromGroup(const QString &group)
*
* Emitted when the value of location() changes.
*
- * \param caps The new location of this contact.
+ * \param location The new location of this contact.
* \sa location()
*/
@@ -1380,7 +1380,7 @@ void Contact::setRemovedFromGroup(const QString &group)
*
* Emitted when the value of infoFields() changes.
*
- * \param InfoFields The new info of this contact.
+ * \param infoFields The new info of this contact.
* \sa infoFields()
*/
@@ -1399,6 +1399,7 @@ void Contact::setRemovedFromGroup(const QString &group)
* Emitted when the value of publishState() changes.
*
* \param state The new publish state of this contact.
+ * \param message The new user-defined status message of this contact.
* \sa publishState()
*/
@@ -1407,7 +1408,7 @@ void Contact::setRemovedFromGroup(const QString &group)
*
* Emitted when the value of isBlocked() changes.
*
- * \param status The new block status of this contact.
+ * \param blocked The new block status of this contact.
* \sa isBlocked()
*/
diff --git a/TelepathyQt/contact.h b/TelepathyQt/contact.h
index dd26a0ea..f5837d94 100644
--- a/TelepathyQt/contact.h
+++ b/TelepathyQt/contact.h
@@ -78,7 +78,7 @@ public:
InfoFields(const InfoFields &other);
~InfoFields();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
InfoFields &operator=(const InfoFields &other);
@@ -92,7 +92,7 @@ public:
QSharedDataPointer<Private> mPriv;
};
- ~Contact();
+ ~Contact() override;
ContactManagerPtr manager() const;
@@ -243,6 +243,6 @@ private:
} // Tp
-Q_DECLARE_METATYPE(Tp::Contact::InfoFields);
+Q_DECLARE_METATYPE(Tp::Contact::InfoFields)
#endif
diff --git a/TelepathyQt/dbus-error.cpp b/TelepathyQt/dbus-error.cpp
index c4768789..587b0e11 100644
--- a/TelepathyQt/dbus-error.cpp
+++ b/TelepathyQt/dbus-error.cpp
@@ -51,7 +51,7 @@ struct TP_QT_NO_EXPORT DBusError::Private
* Construct an empty DBusError
*/
DBusError::DBusError()
- : mPriv(0)
+ : mPriv(nullptr)
{
}
@@ -71,6 +71,9 @@ DBusError::DBusError(const QString &name, const QString &message)
*/
DBusError::~DBusError()
{
+ if (mPriv) {
+ delete mPriv;
+ }
}
/**
@@ -82,10 +85,9 @@ DBusError::~DBusError()
*/
bool DBusError::operator==(const DBusError &other) const
{
- if (!isValid() || !other.isValid()) {
- if (!isValid() && !other.isValid()) {
- return true;
- }
+ if (!isValid() && !other.isValid()) {
+ return true;
+ } else if (!isValid() || !other.isValid()) {
return false;
}
@@ -102,15 +104,7 @@ bool DBusError::operator==(const DBusError &other) const
*/
bool DBusError::operator!=(const DBusError &other) const
{
- if (!isValid() || !other.isValid()) {
- if (!isValid() && !other.isValid()) {
- return false;
- }
- return true;
- }
-
- return mPriv->name != other.mPriv->name ||
- mPriv->message != other.mPriv->message;
+ return !(*this == other);
}
/**
diff --git a/TelepathyQt/dbus-error.h b/TelepathyQt/dbus-error.h
index dcb4afe4..4b7c0815 100644
--- a/TelepathyQt/dbus-error.h
+++ b/TelepathyQt/dbus-error.h
@@ -41,7 +41,7 @@ public:
DBusError(const QString &name, const QString &message);
~DBusError();
- bool isValid() const { return mPriv != 0; }
+ bool isValid() const { return mPriv != nullptr; }
bool operator==(const DBusError &other) const;
bool operator!=(const DBusError &other) const;
diff --git a/TelepathyQt/dbus-object.cpp b/TelepathyQt/dbus-object.cpp
index cab20a01..9e3bdfea 100644
--- a/TelepathyQt/dbus-object.cpp
+++ b/TelepathyQt/dbus-object.cpp
@@ -37,6 +37,7 @@ struct TP_QT_NO_EXPORT DBusObject::Private
}
QDBusConnection dbusConnection;
+ QString objectPath;
};
/**
@@ -68,6 +69,16 @@ DBusObject::~DBusObject()
delete mPriv;
}
+void DBusObject::setObjectPath(const QString &path)
+{
+ mPriv->objectPath = path;
+}
+
+QString DBusObject::objectPath() const
+{
+ return mPriv->objectPath;
+}
+
/**
* Return the D-Bus connection associated with this object.
*
diff --git a/TelepathyQt/dbus-object.h b/TelepathyQt/dbus-object.h
index 1784fe08..506e6c4b 100644
--- a/TelepathyQt/dbus-object.h
+++ b/TelepathyQt/dbus-object.h
@@ -42,15 +42,21 @@ class TP_QT_EXPORT DBusObject : public QObject
Q_DISABLE_COPY(DBusObject)
public:
- DBusObject(const QDBusConnection &dbusConnection, QObject *parent = 0);
- virtual ~DBusObject();
+ DBusObject(const QDBusConnection &dbusConnection, QObject *parent = nullptr);
+ ~DBusObject() override;
+ QString objectPath() const;
QDBusConnection dbusConnection() const;
+protected:
+ void setObjectPath(const QString &path);
+
private:
- class Private;
- friend class Private;
+ struct Private;
+ friend struct Private;
Private *mPriv;
+
+ friend class DBusService;
};
}
diff --git a/TelepathyQt/dbus-proxy-factory-internal.h b/TelepathyQt/dbus-proxy-factory-internal.h
index 7596d784..e9bff396 100644
--- a/TelepathyQt/dbus-proxy-factory-internal.h
+++ b/TelepathyQt/dbus-proxy-factory-internal.h
@@ -43,7 +43,7 @@ public:
typedef QPair<QString /* serviceName */, QString /* objectPath */> Key;
Cache();
- ~Cache();
+ ~Cache() override;
DBusProxyPtr get(const Key &key) const;
void put(const DBusProxyPtr &proxy);
diff --git a/TelepathyQt/dbus-proxy-factory.cpp b/TelepathyQt/dbus-proxy-factory.cpp
index d3d68590..55b07999 100644
--- a/TelepathyQt/dbus-proxy-factory.cpp
+++ b/TelepathyQt/dbus-proxy-factory.cpp
@@ -177,7 +177,7 @@ PendingReady *DBusProxyFactory::nowHaveProxy(const DBusProxyPtr &proxy) const
PendingOperation *DBusProxyFactory::initialPrepare(const DBusProxyPtr &proxy) const
{
// Nothing we could think about needs doing
- return NULL;
+ return nullptr;
}
/**
@@ -194,7 +194,7 @@ PendingOperation *DBusProxyFactory::initialPrepare(const DBusProxyPtr &proxy) co
PendingOperation *DBusProxyFactory::readyPrepare(const DBusProxyPtr &proxy) const
{
// Nothing we could think about needs doing
- return NULL;
+ return nullptr;
}
/**
diff --git a/TelepathyQt/dbus-proxy-factory.h b/TelepathyQt/dbus-proxy-factory.h
index 1a7eaea7..ad0b0672 100644
--- a/TelepathyQt/dbus-proxy-factory.h
+++ b/TelepathyQt/dbus-proxy-factory.h
@@ -51,7 +51,7 @@ class TP_QT_EXPORT DBusProxyFactory : public QObject, public RefCounted
Q_DISABLE_COPY(DBusProxyFactory)
public:
- virtual ~DBusProxyFactory();
+ ~DBusProxyFactory() override;
const QDBusConnection &dbusConnection() const;
diff --git a/TelepathyQt/dbus-proxy.cpp b/TelepathyQt/dbus-proxy.cpp
index d80ce149..3f333046 100644
--- a/TelepathyQt/dbus-proxy.cpp
+++ b/TelepathyQt/dbus-proxy.cpp
@@ -375,7 +375,7 @@ void StatefulDBusProxy::onServiceOwnerChanged(const QString &name, const QString
StatelessDBusProxy::StatelessDBusProxy(const QDBusConnection &dbusConnection,
const QString &busName, const QString &objectPath, const Feature &featureCore)
: DBusProxy(dbusConnection, busName, objectPath, featureCore),
- mPriv(0)
+ mPriv(nullptr)
{
if (busName.startsWith(QLatin1String(":"))) {
warning() <<
diff --git a/TelepathyQt/dbus-proxy.h b/TelepathyQt/dbus-proxy.h
index 0121d722..8a2deab6 100644
--- a/TelepathyQt/dbus-proxy.h
+++ b/TelepathyQt/dbus-proxy.h
@@ -47,7 +47,7 @@ class TP_QT_EXPORT DBusProxy : public Object, public ReadyObject
public:
DBusProxy(const QDBusConnection &dbusConnection, const QString &busName,
const QString &objectPath, const Feature &featureCore);
- virtual ~DBusProxy();
+ ~DBusProxy() override;
QDBusConnection dbusConnection() const;
QString busName() const;
@@ -85,7 +85,7 @@ class TP_QT_EXPORT StatelessDBusProxy : public DBusProxy
public:
StatelessDBusProxy(const QDBusConnection &dbusConnection,
const QString &busName, const QString &objectPath, const Feature &featureCore);
- virtual ~StatelessDBusProxy();
+ ~StatelessDBusProxy() override;
private:
struct Private;
@@ -101,7 +101,7 @@ class TP_QT_EXPORT StatefulDBusProxy : public DBusProxy
public:
StatefulDBusProxy(const QDBusConnection &dbusConnection,
const QString &busName, const QString &objectPath, const Feature &featureCore);
- virtual ~StatefulDBusProxy();
+ ~StatefulDBusProxy() override;
static QString uniqueNameFrom(const QDBusConnection &bus, const QString &wellKnownOrUnique);
static QString uniqueNameFrom(const QDBusConnection &bus, const QString &wellKnownOrUnique,
diff --git a/TelepathyQt/dbus-service.cpp b/TelepathyQt/dbus-service.cpp
index 6a8f978f..a3ff7ac7 100644
--- a/TelepathyQt/dbus-service.cpp
+++ b/TelepathyQt/dbus-service.cpp
@@ -46,7 +46,6 @@ struct TP_QT_NO_EXPORT DBusService::Private
DBusService *parent;
QString busName;
- QString objectPath;
DBusObject *dbusObject;
bool registered;
};
@@ -113,7 +112,7 @@ QString DBusService::busName() const
*/
QString DBusService::objectPath() const
{
- return mPriv->objectPath;
+ return mPriv->dbusObject->objectPath();
}
/**
@@ -165,15 +164,6 @@ bool DBusService::registerObject(const QString &busName, const QString &objectPa
return true;
}
- if (!mPriv->dbusObject->dbusConnection().registerService(busName)) {
- error->set(TP_QT_ERROR_INVALID_ARGUMENT,
- QString(QLatin1String("Name %1 already in use by another process"))
- .arg(busName));
- warning() << "Unable to register service" << busName <<
- "- name already registered by another process";
- return false;
- }
-
if (!mPriv->dbusObject->dbusConnection().registerObject(objectPath, mPriv->dbusObject)) {
error->set(TP_QT_ERROR_INVALID_ARGUMENT,
QString(QLatin1String("Object at path %1 already registered"))
@@ -183,10 +173,20 @@ bool DBusService::registerObject(const QString &busName, const QString &objectPa
return false;
}
+ if (!mPriv->dbusObject->dbusConnection().registerService(busName)) {
+ mPriv->dbusObject->dbusConnection().unregisterObject(objectPath);
+ error->set(TP_QT_ERROR_INVALID_ARGUMENT,
+ QString(QLatin1String("Name %1 already in use by another process"))
+ .arg(busName));
+ warning() << "Unable to register service" << busName <<
+ "- name already registered by another process";
+ return false;
+ }
+
debug() << "Registered object" << objectPath << "at bus name" << busName;
mPriv->busName = busName;
- mPriv->objectPath = objectPath;
+ mPriv->dbusObject->setObjectPath(objectPath);
mPriv->registered = true;
return true;
}
@@ -206,7 +206,7 @@ struct AbstractDBusServiceInterface::Private
{
Private(const QString &interfaceName)
: interfaceName(interfaceName),
- dbusObject(0),
+ dbusObject(nullptr),
registered(false)
{
}
@@ -257,6 +257,11 @@ QString AbstractDBusServiceInterface::interfaceName() const
return mPriv->interfaceName;
}
+QVariantMap AbstractDBusServiceInterface::immutableProperties() const
+{
+ return QVariantMap();
+}
+
/**
* Return the DBusObject on which the adaptor of this interface is plugged.
*
@@ -284,6 +289,33 @@ bool AbstractDBusServiceInterface::isRegistered() const
}
/**
+ * Emit PropertiesChanged signal on object org.freedesktop.DBus.Properties interface
+ * with the property \a propertyName.
+ *
+ * \param propertyName The name of the changed property.
+ * \param propertyValue The actual value of the changed property.
+ * \return \c false if the signal can not be emmited or \a true otherwise.
+ */
+bool AbstractDBusServiceInterface::notifyPropertyChanged(const QString &propertyName, const QVariant &propertyValue)
+{
+ if (!isRegistered()) {
+ return false;
+ }
+
+ QDBusMessage signal = QDBusMessage::createSignal(dbusObject()->objectPath(),
+ TP_QT_IFACE_PROPERTIES,
+ QLatin1String("PropertiesChanged"));
+ QVariantMap changedProperties;
+ changedProperties.insert(propertyName, propertyValue);
+
+ signal << interfaceName();
+ signal << changedProperties;
+ signal << QStringList();
+
+ return dbusObject()->dbusConnection().send(signal);
+}
+
+/**
* Registers this interface by plugging its adaptor
* on the given \a dbusObject.
*
diff --git a/TelepathyQt/dbus-service.h b/TelepathyQt/dbus-service.h
index 59f6d2bf..e95f3525 100644
--- a/TelepathyQt/dbus-service.h
+++ b/TelepathyQt/dbus-service.h
@@ -50,7 +50,7 @@ class TP_QT_EXPORT DBusService : public Object
public:
DBusService(const QDBusConnection &dbusConnection);
- virtual ~DBusService();
+ ~DBusService() override;
virtual QVariantMap immutableProperties() const = 0;
@@ -65,8 +65,8 @@ protected:
DBusError *error);
private:
- class Private;
- friend class Private;
+ struct Private;
+ friend struct Private;
Private *mPriv;
};
@@ -77,11 +77,11 @@ class TP_QT_EXPORT AbstractDBusServiceInterface : public Object
public:
AbstractDBusServiceInterface(const QString &interfaceName);
- virtual ~AbstractDBusServiceInterface();
+ ~AbstractDBusServiceInterface() override;
QString interfaceName() const;
- virtual QVariantMap immutableProperties() const = 0;
+ virtual QVariantMap immutableProperties() const;
DBusObject *dbusObject() const;
bool isRegistered() const;
@@ -90,9 +90,12 @@ protected:
virtual bool registerInterface(DBusObject *dbusObject);
virtual void createAdaptor() = 0;
+public:
+ bool notifyPropertyChanged(const QString &propertyName, const QVariant &propertyValue);
+
private:
- class Private;
- friend class Private;
+ struct Private;
+ friend struct Private;
Private *mPriv;
};
diff --git a/TelepathyQt/dbus-tube-channel.h b/TelepathyQt/dbus-tube-channel.h
index 3ecf8318..d0a96173 100644
--- a/TelepathyQt/dbus-tube-channel.h
+++ b/TelepathyQt/dbus-tube-channel.h
@@ -43,7 +43,7 @@ public:
static DBusTubeChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~DBusTubeChannel();
+ ~DBusTubeChannel() override;
QString serviceName() const;
diff --git a/TelepathyQt/debug-internal.h b/TelepathyQt/debug-internal.h
index 4d28d944..00d1f769 100644
--- a/TelepathyQt/debug-internal.h
+++ b/TelepathyQt/debug-internal.h
@@ -33,9 +33,9 @@ namespace Tp
class TP_QT_EXPORT Debug
{
public:
- inline Debug() : debug(0) { }
+ inline Debug() : debug(nullptr) { }
inline Debug(QtMsgType type) : type(type), debug(new QDebug(&msg)) { }
- inline Debug(const Debug &a) : type(a.type), debug(a.debug ? new QDebug(&msg) : 0)
+ inline Debug(const Debug &a) : type(a.type), debug(a.debug ? new QDebug(&msg) : nullptr)
{
if (debug) {
(*debug) << qPrintable(a.msg);
@@ -47,7 +47,7 @@ public:
if (this != &a) {
type = a.type;
delete debug;
- debug = 0;
+ debug = nullptr;
if (a.debug) {
debug = new QDebug(&msg);
diff --git a/TelepathyQt/debug-receiver.h b/TelepathyQt/debug-receiver.h
index bd44b6fe..e1073c65 100644
--- a/TelepathyQt/debug-receiver.h
+++ b/TelepathyQt/debug-receiver.h
@@ -46,7 +46,7 @@ public:
static DebugReceiverPtr create(const QString &busName,
const QDBusConnection &bus = QDBusConnection::sessionBus());
- virtual ~DebugReceiver();
+ ~DebugReceiver() override;
PendingDebugMessageList *fetchMessages();
PendingOperation *setMonitoringEnabled(bool enabled);
diff --git a/TelepathyQt/debug.cpp b/TelepathyQt/debug.cpp
index 51e4e356..1ca1c207 100644
--- a/TelepathyQt/debug.cpp
+++ b/TelepathyQt/debug.cpp
@@ -100,7 +100,7 @@ namespace
{
bool debugEnabled = false;
bool warningsEnabled = true;
-DebugCallback debugCallback = NULL;
+DebugCallback debugCallback = nullptr;
}
void enableDebug(bool enable)
diff --git a/TelepathyQt/fake-handler-manager-internal.cpp b/TelepathyQt/fake-handler-manager-internal.cpp
index e18ab425..76fff9e1 100644
--- a/TelepathyQt/fake-handler-manager-internal.cpp
+++ b/TelepathyQt/fake-handler-manager-internal.cpp
@@ -86,7 +86,7 @@ void FakeHandler::onChannelDestroyed(QObject *obj)
}
}
-FakeHandlerManager *FakeHandlerManager::mInstance = 0;
+FakeHandlerManager *FakeHandlerManager::mInstance = nullptr;
FakeHandlerManager *FakeHandlerManager::instance()
{
@@ -103,7 +103,7 @@ FakeHandlerManager::FakeHandlerManager()
FakeHandlerManager::~FakeHandlerManager()
{
- mInstance = 0;
+ mInstance = nullptr;
}
ObjectPathList FakeHandlerManager::handledChannels(const QDBusConnection &bus) const
@@ -157,7 +157,7 @@ void FakeHandlerManager::onFakeHandlerInvalidated(FakeHandler *fakeHandler)
if (mFakeHandlers.isEmpty()) {
// set mInstance to 0 here as we don't want instance() to return a already
// deleted instance
- mInstance = 0;
+ mInstance = nullptr;
deleteLater();
}
}
diff --git a/TelepathyQt/fake-handler-manager-internal.h b/TelepathyQt/fake-handler-manager-internal.h
index 356bac95..637304b3 100644
--- a/TelepathyQt/fake-handler-manager-internal.h
+++ b/TelepathyQt/fake-handler-manager-internal.h
@@ -40,7 +40,7 @@ class FakeHandler : public QObject
public:
FakeHandler(const QDBusConnection &bus);
- ~FakeHandler();
+ ~FakeHandler() override;
QDBusConnection dbusConnection() const { return mBus; }
ObjectPathList handledChannels() const;
@@ -66,7 +66,7 @@ class FakeHandlerManager : public QObject
public:
static FakeHandlerManager *instance();
- ~FakeHandlerManager();
+ ~FakeHandlerManager() override;
ObjectPathList handledChannels(const QDBusConnection &bus) const;
void registerClientRegistrar(const ClientRegistrarPtr &cr);
diff --git a/TelepathyQt/feature.h b/TelepathyQt/feature.h
index 07ab3a55..eb4bc9c4 100644
--- a/TelepathyQt/feature.h
+++ b/TelepathyQt/feature.h
@@ -46,7 +46,7 @@ public:
Feature(const Feature &other);
~Feature();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
Feature &operator=(const Feature &other);
@@ -88,7 +88,7 @@ inline uint qHash(const Features &features)
} // Tp
-Q_DECLARE_METATYPE(Tp::Feature);
-Q_DECLARE_METATYPE(Tp::Features);
+Q_DECLARE_METATYPE(Tp::Feature)
+Q_DECLARE_METATYPE(Tp::Features)
#endif
diff --git a/TelepathyQt/file-transfer-channel-creation-properties.cpp b/TelepathyQt/file-transfer-channel-creation-properties.cpp
index e7232b05..dd17f8a1 100644
--- a/TelepathyQt/file-transfer-channel-creation-properties.cpp
+++ b/TelepathyQt/file-transfer-channel-creation-properties.cpp
@@ -130,7 +130,7 @@ FileTransferChannelCreationProperties::FileTransferChannelCreationProperties(
: mPriv(new Private(path, contentType))
{
if (mPriv->suggestedFileName.isEmpty()) {
- mPriv = QSharedDataPointer<Private>(NULL);
+ mPriv = QSharedDataPointer<Private>(nullptr);
}
}
@@ -430,4 +430,75 @@ QString FileTransferChannelCreationProperties::uri() const
return mPriv->uri;
}
+QVariantMap FileTransferChannelCreationProperties::createRequest() const
+{
+ if (!isValid()) {
+ warning() << "Invalid file transfer creation properties";
+ return QVariantMap();
+ }
+
+ QVariantMap request;
+ request.insert(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"),
+ TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER);
+ request.insert(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType"),
+ (uint) Tp::HandleTypeContact);
+
+ request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Filename"),
+ suggestedFileName());
+ request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentType"),
+ contentType());
+ request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Size"),
+ size());
+
+ if (hasContentHash()) {
+ request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentHashType"),
+ (uint) contentHashType());
+ request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentHash"),
+ contentHash());
+ }
+
+ if (hasDescription()) {
+ request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Description"),
+ description());
+ }
+
+ if (hasLastModificationTime()) {
+ request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Date"),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
+ (qulonglong) lastModificationTime().toTime_t());
+#else
+ (qulonglong) lastModificationTime().toSecsSinceEpoch());
+#endif
+ }
+
+ if (hasUri()) {
+ request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".URI"),
+ uri());
+ }
+
+ return request;
+}
+
+QVariantMap FileTransferChannelCreationProperties::createRequest(const QString &contactIdentifier) const
+{
+ QVariantMap request = createRequest();
+
+ if (!request.isEmpty()) {
+ request.insert(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetID"), contactIdentifier);
+ }
+
+ return request;
+}
+
+QVariantMap FileTransferChannelCreationProperties::createRequest(uint handle) const
+{
+ QVariantMap request = createRequest();
+
+ if (!request.isEmpty()) {
+ request.insert(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle"), handle);
+ }
+
+ return request;
+}
+
} // Tp
diff --git a/TelepathyQt/file-transfer-channel-creation-properties.h b/TelepathyQt/file-transfer-channel-creation-properties.h
index a3904b4c..dd33bca5 100644
--- a/TelepathyQt/file-transfer-channel-creation-properties.h
+++ b/TelepathyQt/file-transfer-channel-creation-properties.h
@@ -34,6 +34,7 @@
#include <QMetaType>
#include <QSharedDataPointer>
#include <QString>
+#include <QVariantMap>
namespace Tp
{
@@ -50,7 +51,7 @@ public:
const FileTransferChannelCreationProperties &other);
~FileTransferChannelCreationProperties();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
FileTransferChannelCreationProperties &operator=(
const FileTransferChannelCreationProperties &other);
@@ -83,6 +84,10 @@ public:
bool hasUri() const;
QString uri() const;
+ QVariantMap createRequest() const;
+ QVariantMap createRequest(const QString &contactIdentifier) const;
+ QVariantMap createRequest(uint handle) const;
+
private:
struct Private;
friend struct Private;
@@ -91,6 +96,6 @@ private:
} // Tp
-Q_DECLARE_METATYPE(Tp::FileTransferChannelCreationProperties);
+Q_DECLARE_METATYPE(Tp::FileTransferChannelCreationProperties)
#endif
diff --git a/TelepathyQt/file-transfer-channel.cpp b/TelepathyQt/file-transfer-channel.cpp
index ec72fbbd..718ab48e 100644
--- a/TelepathyQt/file-transfer-channel.cpp
+++ b/TelepathyQt/file-transfer-channel.cpp
@@ -134,7 +134,11 @@ void FileTransferChannel::Private::extractProperties(const QVariantMap &props)
uri = qdbus_cast<QString>(props[QLatin1String("URI")]);
contentHash = qdbus_cast<QString>(props[QLatin1String("ContentHash")]);
description = qdbus_cast<QString>(props[QLatin1String("Description")]);
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
lastModificationTime.setTime_t((uint) qdbus_cast<qulonglong>(props[QLatin1String("Date")]));
+#else
+ lastModificationTime.setSecsSinceEpoch((uint) qdbus_cast<qulonglong>(props[QLatin1String("Date")]));
+#endif
contentHashType = (FileHashType) qdbus_cast<uint>(props[QLatin1String("ContentHashType")]);
initialOffset = qdbus_cast<qulonglong>(props[QLatin1String("InitialOffset")]);
size = qdbus_cast<qulonglong>(props[QLatin1String("Size")]);
diff --git a/TelepathyQt/file-transfer-channel.h b/TelepathyQt/file-transfer-channel.h
index a904b840..cad57d2c 100644
--- a/TelepathyQt/file-transfer-channel.h
+++ b/TelepathyQt/file-transfer-channel.h
@@ -43,7 +43,7 @@ public:
static FileTransferChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~FileTransferChannel();
+ ~FileTransferChannel() override;
FileTransferState state() const;
FileTransferStateChangeReason stateReason() const;
diff --git a/TelepathyQt/filter.h b/TelepathyQt/filter.h
index 33a5a8ca..db7cf0d0 100644
--- a/TelepathyQt/filter.h
+++ b/TelepathyQt/filter.h
@@ -39,7 +39,7 @@ class Filter : public RefCounted
Q_DISABLE_COPY(Filter)
public:
- virtual ~Filter() {}
+ ~Filter() override {}
virtual bool isValid() const { return false; }
diff --git a/TelepathyQt/fixed-feature-factory.h b/TelepathyQt/fixed-feature-factory.h
index 62672c7c..43c2ed88 100644
--- a/TelepathyQt/fixed-feature-factory.h
+++ b/TelepathyQt/fixed-feature-factory.h
@@ -46,7 +46,7 @@ class TP_QT_EXPORT FixedFeatureFactory : public DBusProxyFactory
Q_DISABLE_COPY(FixedFeatureFactory)
public:
- virtual ~FixedFeatureFactory();
+ ~FixedFeatureFactory() override;
Features features() const;
@@ -56,7 +56,7 @@ public:
protected:
FixedFeatureFactory(const QDBusConnection &bus);
- virtual Features featuresFor(const DBusProxyPtr &proxy) const;
+ Features featuresFor(const DBusProxyPtr &proxy) const override;
private:
struct Private;
diff --git a/TelepathyQt/generic-capability-filter.h b/TelepathyQt/generic-capability-filter.h
index ece57895..0ce2c801 100644
--- a/TelepathyQt/generic-capability-filter.h
+++ b/TelepathyQt/generic-capability-filter.h
@@ -45,11 +45,11 @@ public:
rccSpecs));
}
- inline virtual ~GenericCapabilityFilter() { }
+ inline ~GenericCapabilityFilter() override { }
- inline virtual bool isValid() const { return true; }
+ inline bool isValid() const override { return true; }
- inline virtual bool matches(const SharedPtr<T> &t) const
+ inline bool matches(const SharedPtr<T> &t) const override
{
bool supportedRcc;
RequestableChannelClassSpecList objectRccSpecs = t->capabilities().allClassSpecs();
diff --git a/TelepathyQt/generic-property-filter.h b/TelepathyQt/generic-property-filter.h
index ac56b595..01299e3c 100644
--- a/TelepathyQt/generic-property-filter.h
+++ b/TelepathyQt/generic-property-filter.h
@@ -37,11 +37,11 @@ template <class T>
class GenericPropertyFilter : public Filter<T>
{
public:
- inline virtual ~GenericPropertyFilter() { }
+ inline ~GenericPropertyFilter() override { }
- inline virtual bool isValid() const { return true; }
+ inline bool isValid() const override { return true; }
- inline virtual bool matches(const SharedPtr<T> &t) const
+ inline bool matches(const SharedPtr<T> &t) const override
{
for (QVariantMap::const_iterator i = mFilter.constBegin();
i != mFilter.constEnd(); ++i) {
diff --git a/TelepathyQt/global.h b/TelepathyQt/global.h.in
index abb1c546..6b8ec440 100644
--- a/TelepathyQt/global.h
+++ b/TelepathyQt/global.h.in
@@ -29,6 +29,26 @@
#include <QtGlobal>
+#define TP_QT_MAJOR_VERSION @TP_QT_MAJOR_VERSION@
+#define TP_QT_MINOR_VERSION @TP_QT_MINOR_VERSION@
+#define TP_QT_MICRO_VERSION @TP_QT_MICRO_VERSION@
+#define TP_QT_VERSION ((TP_QT_MAJOR_VERSION<<16)|(TP_QT_MINOR_VERSION<<8)|(TP_QT_MICRO_VERSION))
+
+/**
+ * @def TP_QT_VERSION_CHECK
+ * @ingroup macros
+ *
+ * The TP_QT_VERSION_CHECK macro can be used to do condition compilation
+ * in TelepathyQt-based applications and libraries.
+ *
+ * \code
+ * #if (TP_QT_VERSION >= TP_QT_VERSION_CHECK(0, 9, 6))
+ * Tp::BaseConnectionAvatarsInterfacePtr avatarsIface;
+ * #endif
+ * \endcode
+ */
+#define TP_QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
+
#ifdef BUILDING_TP_QT
# define TP_QT_EXPORT Q_DECL_EXPORT
#else
diff --git a/TelepathyQt/groups.dox b/TelepathyQt/groups.dox
index a5415c4d..31627abd 100644
--- a/TelepathyQt/groups.dox
+++ b/TelepathyQt/groups.dox
@@ -139,7 +139,7 @@
*/
/**
- * \defgroup utils Utililty classes
+ * \defgroup utils Utililty classes and functions
*
- * Utility classes.
+ * Utility classes and functions
*/
diff --git a/TelepathyQt/handled-channel-notifier.h b/TelepathyQt/handled-channel-notifier.h
index 6474031e..c6b5fe7b 100644
--- a/TelepathyQt/handled-channel-notifier.h
+++ b/TelepathyQt/handled-channel-notifier.h
@@ -44,7 +44,7 @@ class TP_QT_EXPORT HandledChannelNotifier : public QObject
Q_DISABLE_COPY(HandledChannelNotifier)
public:
- ~HandledChannelNotifier();
+ ~HandledChannelNotifier() override;
ChannelPtr channel() const;
@@ -53,7 +53,7 @@ Q_SIGNALS:
protected:
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
- void connectNotify(const QMetaMethod &signal);
+ void connectNotify(const QMetaMethod &signal) override;
#else
void connectNotify(const char *signal);
#endif
diff --git a/TelepathyQt/incoming-dbus-tube-channel.h b/TelepathyQt/incoming-dbus-tube-channel.h
index 9de7652c..20a087ac 100644
--- a/TelepathyQt/incoming-dbus-tube-channel.h
+++ b/TelepathyQt/incoming-dbus-tube-channel.h
@@ -41,7 +41,7 @@ public:
static IncomingDBusTubeChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~IncomingDBusTubeChannel();
+ ~IncomingDBusTubeChannel() override;
PendingDBusTubeConnection *acceptTube(bool allowOtherUsers = false);
diff --git a/TelepathyQt/incoming-file-transfer-channel.cpp b/TelepathyQt/incoming-file-transfer-channel.cpp
index 096ede03..d7d5e635 100644
--- a/TelepathyQt/incoming-file-transfer-channel.cpp
+++ b/TelepathyQt/incoming-file-transfer-channel.cpp
@@ -54,15 +54,17 @@ struct TP_QT_NO_EXPORT IncomingFileTransferChannel::Private
qulonglong requestedOffset;
qint64 pos;
+ bool weOpenedDevice;
};
IncomingFileTransferChannel::Private::Private(IncomingFileTransferChannel *parent)
: parent(parent),
fileTransferInterface(parent->interface<Client::ChannelTypeFileTransferInterface>()),
- output(0),
- socket(0),
+ output(nullptr),
+ socket(nullptr),
requestedOffset(0),
- pos(0)
+ pos(0),
+ weOpenedDevice(false)
{
parent->connect(fileTransferInterface,
SIGNAL(URIDefined(QString)),
@@ -232,12 +234,18 @@ PendingOperation *IncomingFileTransferChannel::acceptFile(qulonglong offset,
IncomingFileTransferChannelPtr(this));
}
- if ((!output->isOpen() && !output->open(QIODevice::WriteOnly)) &&
- (!output->isWritable())) {
+ if (!output->isOpen()) {
+ if (output->open(QIODevice::WriteOnly)) {
+ mPriv->weOpenedDevice = true;
+ }
+ }
+
+ if (!output->isWritable()) {
+ mPriv->weOpenedDevice = false;
warning() << "Unable to open IO device for writing";
return new PendingFailure(TP_QT_ERROR_PERMISSION_DENIED,
- QLatin1String("Unable to open IO device for writing"),
- IncomingFileTransferChannelPtr(this));
+ QLatin1String("Unable to open IO device for writing"),
+ IncomingFileTransferChannelPtr(this));
}
mPriv->output = output;
@@ -371,7 +379,7 @@ void IncomingFileTransferChannel::setFinished()
mPriv->socket->close();
}
- if (mPriv->output) {
+ if (mPriv->output && mPriv->weOpenedDevice) {
mPriv->output->close();
}
diff --git a/TelepathyQt/incoming-file-transfer-channel.h b/TelepathyQt/incoming-file-transfer-channel.h
index 01937d3f..b5e54123 100644
--- a/TelepathyQt/incoming-file-transfer-channel.h
+++ b/TelepathyQt/incoming-file-transfer-channel.h
@@ -45,7 +45,7 @@ public:
static IncomingFileTransferChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~IncomingFileTransferChannel();
+ ~IncomingFileTransferChannel() override;
PendingOperation *setUri(const QString& uri);
PendingOperation *acceptFile(qulonglong offset, QIODevice *output);
@@ -68,8 +68,8 @@ private Q_SLOTS:
TP_QT_NO_EXPORT void doTransfer();
private:
- TP_QT_NO_EXPORT void connectToHost();
- TP_QT_NO_EXPORT void setFinished();
+ TP_QT_NO_EXPORT void connectToHost() override;
+ TP_QT_NO_EXPORT void setFinished() override;
struct Private;
friend struct Private;
diff --git a/TelepathyQt/incoming-stream-tube-channel.cpp b/TelepathyQt/incoming-stream-tube-channel.cpp
index 12468247..55611408 100644
--- a/TelepathyQt/incoming-stream-tube-channel.cpp
+++ b/TelepathyQt/incoming-stream-tube-channel.cpp
@@ -383,14 +383,14 @@ PendingStreamTubeConnection *IncomingStreamTubeChannel::acceptTubeAsUnixSocket(
QDBusVariant accessControlParam;
uchar credentialByte = 0;
if (accessControl == SocketAccessControlLocalhost) {
- accessControlParam.setVariant(qVariantFromValue(static_cast<uint>(0)));
+ accessControlParam.setVariant(QVariant::fromValue(static_cast<uint>(0)));
} else if (accessControl == SocketAccessControlCredentials) {
if (mPriv->initRandom) {
qsrand(QTime::currentTime().msec());
mPriv->initRandom = false;
}
credentialByte = static_cast<uchar>(qrand());
- accessControlParam.setVariant(qVariantFromValue(credentialByte));
+ accessControlParam.setVariant(QVariant::fromValue(credentialByte));
} else {
Q_ASSERT(false);
}
diff --git a/TelepathyQt/incoming-stream-tube-channel.h b/TelepathyQt/incoming-stream-tube-channel.h
index edb24367..d7ef2f82 100644
--- a/TelepathyQt/incoming-stream-tube-channel.h
+++ b/TelepathyQt/incoming-stream-tube-channel.h
@@ -48,7 +48,7 @@ public:
static IncomingStreamTubeChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~IncomingStreamTubeChannel();
+ ~IncomingStreamTubeChannel() override;
PendingStreamTubeConnection *acceptTubeAsTcpSocket();
PendingStreamTubeConnection *acceptTubeAsTcpSocket(const QHostAddress &allowedAddress,
diff --git a/TelepathyQt/io-device.cpp b/TelepathyQt/io-device.cpp
new file mode 100644
index 00000000..2cd516dc
--- /dev/null
+++ b/TelepathyQt/io-device.cpp
@@ -0,0 +1,107 @@
+/**
+ * This file is part of TelepathyQt
+ *
+ * @copyright Copyright (C) 2016 Niels Ole Salscheider <niels_ole@salscheider-online.de>
+ * @copyright Copyright (C) 2016 Alexandr Akulich <akulichalexander@gmail.com>
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <TelepathyQt/IODevice>
+
+#include "TelepathyQt/_gen/io-device.moc.hpp"
+
+namespace Tp
+{
+
+struct TP_QT_NO_EXPORT IODevice::Private
+{
+ QByteArray data;
+};
+
+/**
+ * \class IODevice
+ * \ingroup utils
+ * \headerfile <TelepathyQt/IODevice>
+ *
+ * \brief The IODevice class represents a buffer with independent read-write.
+ *
+ * QBuffer has one position pointer, so when we write data, the position
+ * pointer points to the end of the buffer and no bytes can be read.
+ *
+ * This class is interesting for all CMs that use a library that accepts a
+ * QIODevice for file transfers.
+ *
+ * Note: This class belongs to the service library.
+ */
+
+IODevice::IODevice(QObject *parent) :
+ QIODevice(parent),
+ mPriv(new Private)
+{
+}
+
+IODevice::~IODevice()
+{
+ delete mPriv;
+}
+
+qint64 IODevice::bytesAvailable() const
+{
+ return QIODevice::bytesAvailable() + mPriv->data.size();
+}
+
+/**
+ * Returns the number of bytes that are available for reading.
+ *
+ * \return the number of bytes that are available for reading.
+ */
+bool IODevice::isSequential() const
+{
+ return true;
+}
+
+qint64 IODevice::readData(char *data, qint64 maxSize)
+{
+ qint64 size = qMin<qint64>(mPriv->data.size(), maxSize);
+ memcpy(data, mPriv->data.constData(), size);
+ mPriv->data.remove(0, size);
+ return size;
+}
+
+/**
+ * Writes the data to the buffer.
+ *
+ * Writes up to \a maxSize bytes from \a data to the buffer.
+ * If maxSize is not a zero, emits readyRead() and bytesWritten() signals.
+ *
+ * \param data The data to write.
+ * \param maxSize The number for bytes to write.
+ * \return The number of bytes that were written.
+ */
+qint64 IODevice::writeData(const char *data, qint64 maxSize)
+{
+ if (maxSize <= 0) {
+ return 0;
+ }
+
+ mPriv->data.append(data, maxSize);
+ Q_EMIT bytesWritten(maxSize);
+ Q_EMIT readyRead();
+ return maxSize;
+}
+
+}
diff --git a/TelepathyQt/io-device.h b/TelepathyQt/io-device.h
new file mode 100644
index 00000000..2a4aa4a9
--- /dev/null
+++ b/TelepathyQt/io-device.h
@@ -0,0 +1,58 @@
+/**
+ * This file is part of TelepathyQt
+ *
+ * @copyright Copyright (C) 2016 Niels Ole Salscheider <niels_ole@salscheider-online.de>
+ * @copyright Copyright (C) 2016 Alexandr Akulich <akulichalexander@gmail.com>
+ * @license LGPL 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _TelepathyQt_io_device_h_HEADER_GUARD_
+#define _TelepathyQt_io_device_h_HEADER_GUARD_
+
+#ifndef IN_TP_QT_HEADER
+#error IN_TP_QT_HEADER
+#endif
+
+#include <TelepathyQt/Global>
+
+#include <QIODevice>
+
+namespace Tp
+{
+
+class TP_QT_EXPORT IODevice : public QIODevice
+{
+ Q_OBJECT
+public:
+ explicit IODevice(QObject *parent = nullptr);
+ ~IODevice() override;
+ bool isSequential() const override;
+ qint64 bytesAvailable() const override;
+
+protected:
+ qint64 readData(char *data, qint64 maxSize) override;
+ qint64 writeData(const char *data, qint64 maxSize) override;
+
+private:
+ struct Private;
+ friend struct Private;
+ Private *mPriv;
+};
+
+} // namespace Tp
+
+#endif // _TelepathyQt_io_device_h_HEADER_GUARD_
diff --git a/TelepathyQt/key-file.h b/TelepathyQt/key-file.h
index 7f811dc9..936fc35c 100644
--- a/TelepathyQt/key-file.h
+++ b/TelepathyQt/key-file.h
@@ -84,7 +84,7 @@ private:
}
-Q_DECLARE_METATYPE(Tp::KeyFile);
+Q_DECLARE_METATYPE(Tp::KeyFile)
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
diff --git a/TelepathyQt/location-info.cpp b/TelepathyQt/location-info.cpp
index db7ac75b..866530d0 100644
--- a/TelepathyQt/location-info.cpp
+++ b/TelepathyQt/location-info.cpp
@@ -199,7 +199,11 @@ QDateTime LocationInfo::timestamp() const
qlonglong t = qdbus_cast<qlonglong>(mPriv->location.value(
QLatin1String("timestamp")));
if (t != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
return QDateTime::fromTime_t((uint) t);
+#else
+ return QDateTime::fromSecsSinceEpoch((uint) t);
+#endif
}
return QDateTime();
}
diff --git a/TelepathyQt/location-info.h b/TelepathyQt/location-info.h
index 221fbed2..62e4c8a8 100644
--- a/TelepathyQt/location-info.h
+++ b/TelepathyQt/location-info.h
@@ -45,7 +45,7 @@ public:
LocationInfo(const LocationInfo &other);
virtual ~LocationInfo();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
LocationInfo &operator=(const LocationInfo &other);
@@ -90,6 +90,6 @@ private:
} // Tp
-Q_DECLARE_METATYPE(Tp::LocationInfo);
+Q_DECLARE_METATYPE(Tp::LocationInfo)
#endif
diff --git a/TelepathyQt/main.dox b/TelepathyQt/main.dox
index faf4a9eb..0fc47968 100644
--- a/TelepathyQt/main.dox
+++ b/TelepathyQt/main.dox
@@ -1,7 +1,7 @@
/*
* This file is part of TelepathyQt
*
- * @copyright Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
+ * @copyright Copyright (C) 2008 Collabora Ltd. <https://www.collabora.co.uk/>
* @copyright Copyright (C) 2008 Nokia Corporation
*
* This library is free software; you can redistribute it and/or
@@ -20,45 +20,48 @@
*/
/**
- * \mainpage Telepathy-Qt
+ * \mainpage TelepathyQt
*
* \section Introduction
*
- * Telepathy-Qt is a Qt high-level binding for \telepathy.
+ * TelepathyQt is a Qt high-level bindings library for \telepathy.
*
* \telepathy is a \dbus framework for unifying real time communication, including instant
* messaging, voice calls and video calls. It abstracts differences between protocols to
* provide a unified interface for applications.
*
- * Releases can be found <a
- * href="http://telepathy.freedesktop.org/releases/telepathy-qt">here</a>.
+ * [Releases](https://telepathy.freedesktop.org/releases/telepathy-qt) -
+ * [Git repository](https://github.com/TelepathyIM/telepathy-qt)
*
- * Development is done in the git repository found <a
- * href="http://cgit.freedesktop.org/telepathy/telepathy-qt/">here</a>.
+ * \section documentation Documentation
+ * Getting started:
+ * - \subpage installation
*
- * \li <a href="classes.html">All Classes</a>
+ * Understanding concepts:
+ * - \subpage async_model
+ * - \subpage shared_ptr
+ * - \subpage callbacks
*
- * \section getting_started Getting Started
- * \li \subpage installation
+ * API documentation:
+ * - [Modules (API Groups)](modules.html)
+ * - [All Classes](classes.html)
*
* \section examples Examples
*
- * This is the list of examples in Telepathy-Qt's examples directory.
- * The examples demonstrate Telepathy-Qt features in small, self-contained
+ * This is the list of examples in TelepathyQt's examples directory.
+ * The examples demonstrate TelepathyQt features in small, self-contained
* programs. They are not all designed to be impressive when you run them,
- * but their source code is carefully written to show good Telepathy-Qt
+ * but their source code is carefully written to show good TelepathyQt
* programming practices.
*
- * \li \subpage accounts_example
- * \li \subpage contact_messenger_example
- * \li \subpage protocols_example
- * \li \subpage roster_example
+ * - \subpage accounts_example
+ * - \subpage contact_messenger_example
+ * - \subpage protocols_example
+ * - \subpage roster_example
*
* \section developer_resources Further Information
- * \li \subpage bugreport
- * \li \subpage mailing_lists
- * \li \subpage async_model
- * \li \subpage shared_ptr
+ * - \subpage bugreport
+ * - \subpage mailing_lists
*/
/**
@@ -68,21 +71,21 @@
*
* \subsection installation_from_source_requirements Requirements
*
- * Building Telepathy-Qt requires:
- * \li Qt, including QtDBus <http://www.qtsoftware.com/>
- * \li GNU make <http://www.gnu.org/software/make/>
- * \li pkg-config <http://ftp.gnome.org/pub/GNOME/sources/pkg-config/>
- * \li libxslt, xsltproc <http://xmlsoft.org/XSLT/>
- * \li Python <http://www.python.org/>
+ * Building TelepathyQt requires:
+ * - Qt, including QtDBus <https://www.qt.io/>
+ * - GNU make <https://www.gnu.org/software/make/>
+ * - pkg-config <https://ftp.gnome.org/pub/GNOME/sources/pkg-config/>
+ * - libxslt, xsltproc <https://xmlsoft.org/XSLT/>
+ * - Python <https://www.python.org/>
*
* For the full set of regression tests to run, you'll also need:
- * \li telepathy-glib <http://telepathy.freedesktop.org/releases/telepathy-glib/>
+ * - telepathy-glib <https://telepathy.freedesktop.org/releases/telepathy-glib/>
*
* and to build the example VoIP call UI (examples/call), you'll need:
- * \li telepathy-glib <http://telepathy.freedesktop.org/releases/telepathy-glib/>
- * \li telepathy-farstream
- * <http://telepathy.freedesktop.org/releases/telepathy-farstream/>
- * \li GStreamer <http://gstreamer.freedesktop.org/>\n
+ * - telepathy-glib <https://telepathy.freedesktop.org/releases/telepathy-glib/>
+ * - telepathy-farstream
+ * <https://telepathy.freedesktop.org/releases/telepathy-farstream/>
+ * - GStreamer <https://gstreamer.freedesktop.org/>
*
* Building also requires the cmake build system.
*
@@ -100,34 +103,32 @@
/**
* \page bugreport How to report a bug
*
- * Before reporting a bug, please check the <a
- * href="https://bugs.freedesktop.org/query.cgi?product=Telepathy&component=telepathy-qt">
- * Bug Tracker</a> to see if the issue is already known.
+ * Before reporting a bug, please check the
+ * [GitHub issues](https://github.com/TelepathyIM/telepathy-qt/issues)
+ * and
+ * [Bug Tracker](https://bugs.freedesktop.org/query.cgi?product=Telepathy&component=tp-qt)
+ * to see if the issue is already known.
*
* Always include the following information in your bug report:
- * \li The version of Telepathy-Qt you are using
+ * - The version of TelepathyQt you are using
*
* Please submit the bug report, feature request or "to-do" item
- * <a
- * href="https://bugs.freedesktop.org/enter_bug.cgi?product=Telepathy&component=telepathy-qt">
- * here</a>.
+ * [here](https://github.com/TelepathyIM/telepathy-qt/issues).
*/
/**
* \page mailing_lists Mailing Lists
*
- * <a href="http://lists.freedesktop.org/mailman/listinfo/telepathy">General
- * discussion list</a>\n
+ * [General discussion list](https://lists.freedesktop.org/mailman/listinfo/telepathy)
+ * \n
* This list should be used for general discussion about \telepathy usage,
* development.
*
- * <a
- * href="http://lists.freedesktop.org/mailman/listinfo/telepathy-commits">
- * Commits list</a>\n
+ * [Commits list](https://lists.freedesktop.org/mailman/listinfo/telepathy-commits)
+ * \n
* Subscribe to this list to follow the commits.
*
- * <a
- * href="http://lists.freedesktop.org/mailman/listinfo/telepathy-bugs">
- * Bugs list</a>\n
+ * [Bugs list](https://lists.freedesktop.org/mailman/listinfo/telepathy-bugs)
+ * \n
* Subscribe to this list to follow the bug reports.
*/
diff --git a/TelepathyQt/manager-file.cpp b/TelepathyQt/manager-file.cpp
index f41d9550..816b90f9 100644
--- a/TelepathyQt/manager-file.cpp
+++ b/TelepathyQt/manager-file.cpp
@@ -351,7 +351,7 @@ ParamSpec *ManagerFile::Private::getParameter(const QString &protocol,
return &paramSpec;
}
}
- return NULL;
+ return nullptr;
}
QStringList ManagerFile::Private::protocols() const
diff --git a/TelepathyQt/manager-file.h b/TelepathyQt/manager-file.h
index 0b617022..254084a5 100644
--- a/TelepathyQt/manager-file.h
+++ b/TelepathyQt/manager-file.h
@@ -68,7 +68,7 @@ private:
}
-Q_DECLARE_METATYPE(Tp::ManagerFile);
+Q_DECLARE_METATYPE(Tp::ManagerFile)
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
diff --git a/TelepathyQt/message-content-part.h b/TelepathyQt/message-content-part.h
index 7ad289e6..031c4f38 100644
--- a/TelepathyQt/message-content-part.h
+++ b/TelepathyQt/message-content-part.h
@@ -41,7 +41,7 @@ public:
MessageContentPart(const MessageContentPart &other);
~MessageContentPart();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
MessageContentPart &operator=(const MessageContentPart &other);
bool operator==(const MessageContentPart &other) const;
@@ -90,7 +90,7 @@ public:
} // Tp
-Q_DECLARE_METATYPE(Tp::MessageContentPart);
-Q_DECLARE_METATYPE(Tp::MessageContentPartList);
+Q_DECLARE_METATYPE(Tp::MessageContentPart)
+Q_DECLARE_METATYPE(Tp::MessageContentPartList)
#endif
diff --git a/TelepathyQt/message.cpp b/TelepathyQt/message.cpp
index bafec2b2..2538f41c 100644
--- a/TelepathyQt/message.cpp
+++ b/TelepathyQt/message.cpp
@@ -101,7 +101,7 @@ struct TP_QT_NO_EXPORT Message::Private : public QSharedData
Message::Private::Private(const MessagePartList &parts)
: parts(parts),
forceNonText(false),
- sender(0)
+ sender(nullptr)
{
}
@@ -242,7 +242,11 @@ QDateTime Message::sent() const
// FIXME See http://bugs.freedesktop.org/show_bug.cgi?id=21690
uint stamp = valueFromPart(mPriv->parts, 0, "message-sent").toUInt();
if (stamp != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
return QDateTime::fromTime_t(stamp);
+#else
+ return QDateTime::fromSecsSinceEpoch(stamp);
+#endif
} else {
return QDateTime();
}
@@ -376,10 +380,14 @@ QString Message::text() const
QString text;
for (int i = 1; i < size(); i++) {
- QString altGroup = stringOrEmptyFromPart(mPriv->parts, i, "alternative");
- QString contentType = stringOrEmptyFromPart(mPriv->parts, i, "content-type");
+ const QString contentType = stringOrEmptyFromPart(mPriv->parts, i, "content-type");
if (contentType == QLatin1String("text/plain")) {
+ const QString interface = valueFromPart(mPriv->parts, i, "interface").toString();
+ if (!interface.isEmpty()) {
+ continue;
+ }
+ const QString altGroup = stringOrEmptyFromPart(mPriv->parts, i, "alternative");
if (!altGroup.isEmpty()) {
if (altGroupsUsed.contains(altGroup)) {
continue;
@@ -725,7 +733,11 @@ ReceivedMessage::ReceivedMessage(const MessagePartList &parts,
if (!mPriv->parts[0].contains(QLatin1String("message-received"))) {
mPriv->parts[0].insert(QLatin1String("message-received"),
QDBusVariant(static_cast<qlonglong>(
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t())));
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch())));
+#endif
}
mPriv->textChannel = channel;
}
@@ -767,7 +779,11 @@ QDateTime ReceivedMessage::received() const
// FIXME See http://bugs.freedesktop.org/show_bug.cgi?id=21690
uint stamp = valueFromPart(mPriv->parts, 0, "message-received").toUInt();
if (stamp != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
return QDateTime::fromTime_t(stamp);
+#else
+ return QDateTime::fromSecsSinceEpoch(stamp);
+#endif
} else {
return QDateTime();
}
@@ -844,6 +860,18 @@ bool ReceivedMessage::isRescued() const
}
/**
+ * Return whether the incoming message should trigger a user notification.
+ *
+ * If \c true, UI should not notify the user about this message.
+ *
+ * \return \c true if the silent flag is set, \c false otherwise.
+ */
+bool ReceivedMessage::isSilent() const
+{
+ return booleanFromPart(mPriv->parts, 0, "silent", false);
+}
+
+/**
* Return whether the incoming message is a delivery report.
*
* \return \c true if a delivery report, \c false otherwise.
diff --git a/TelepathyQt/message.h b/TelepathyQt/message.h
index c6a0211c..7aa6bc2a 100644
--- a/TelepathyQt/message.h
+++ b/TelepathyQt/message.h
@@ -106,7 +106,7 @@ public:
DeliveryDetails &operator=(const DeliveryDetails &other);
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
DeliveryStatus status() const;
@@ -146,26 +146,27 @@ public:
bool isScrollback() const;
bool isRescued() const;
+ bool isSilent() const;
bool isDeliveryReport() const;
DeliveryDetails deliveryDetails() const;
bool isFromChannel(const TextChannelPtr &channel) const;
-private:
+protected:
friend class TextChannel;
- TP_QT_NO_EXPORT ReceivedMessage(const MessagePartList &parts,
+ ReceivedMessage(const MessagePartList &parts,
const TextChannelPtr &channel);
- TP_QT_NO_EXPORT ReceivedMessage();
+ ReceivedMessage();
- TP_QT_NO_EXPORT uint senderHandle() const;
- TP_QT_NO_EXPORT QString senderId() const;
- TP_QT_NO_EXPORT uint pendingId() const;
+ uint senderHandle() const;
+ QString senderId() const;
+ uint pendingId() const;
- TP_QT_NO_EXPORT void setForceNonText();
- TP_QT_NO_EXPORT void clearSenderHandle();
- TP_QT_NO_EXPORT void setSender(const ContactPtr &sender);
+ void setForceNonText();
+ void clearSenderHandle();
+ void setSender(const ContactPtr &sender);
};
} // Tp
diff --git a/TelepathyQt/method-invocation-context.h b/TelepathyQt/method-invocation-context.h
index 79f6476e..f5581ae3 100644
--- a/TelepathyQt/method-invocation-context.h
+++ b/TelepathyQt/method-invocation-context.h
@@ -97,7 +97,7 @@ public:
mMessage.setDelayedReply(true);
}
- virtual ~MethodInvocationContext()
+ ~MethodInvocationContext() override
{
if (!mFinished) {
setFinishedWithError(QString(), QString());
@@ -119,14 +119,14 @@ public:
mFinished = true;
- setReplyValue(0, qVariantFromValue(t1));
- setReplyValue(1, qVariantFromValue(t2));
- setReplyValue(2, qVariantFromValue(t3));
- setReplyValue(3, qVariantFromValue(t4));
- setReplyValue(4, qVariantFromValue(t5));
- setReplyValue(5, qVariantFromValue(t6));
- setReplyValue(6, qVariantFromValue(t7));
- setReplyValue(7, qVariantFromValue(t8));
+ setReplyValue(0, QVariant::fromValue(t1));
+ setReplyValue(1, QVariant::fromValue(t2));
+ setReplyValue(2, QVariant::fromValue(t3));
+ setReplyValue(3, QVariant::fromValue(t4));
+ setReplyValue(4, QVariant::fromValue(t5));
+ setReplyValue(5, QVariant::fromValue(t6));
+ setReplyValue(6, QVariant::fromValue(t7));
+ setReplyValue(7, QVariant::fromValue(t8));
if (mReply.isEmpty()) {
mBus.send(mMessage.createReply());
diff --git a/TelepathyQt/object.h b/TelepathyQt/object.h
index 7e24fb88..c69a5e4c 100644
--- a/TelepathyQt/object.h
+++ b/TelepathyQt/object.h
@@ -42,7 +42,7 @@ class TP_QT_EXPORT Object : public QObject, public RefCounted
Q_DISABLE_COPY(Object)
public:
- virtual ~Object();
+ ~Object() override;
Q_SIGNALS:
void propertyChanged(const QString &propertyName);
diff --git a/TelepathyQt/optional-interface-factory.cpp b/TelepathyQt/optional-interface-factory.cpp
index e512962a..541763fb 100644
--- a/TelepathyQt/optional-interface-factory.cpp
+++ b/TelepathyQt/optional-interface-factory.cpp
@@ -75,7 +75,7 @@ AbstractInterface *OptionalInterfaceCache::getCached(const QString &name) const
if (mPriv->interfaces.contains(name)) {
return mPriv->interfaces.value(name);
} else {
- return 0;
+ return nullptr;
}
}
diff --git a/TelepathyQt/optional-interface-factory.h b/TelepathyQt/optional-interface-factory.h
index fb3f1309..83a73894 100644
--- a/TelepathyQt/optional-interface-factory.h
+++ b/TelepathyQt/optional-interface-factory.h
@@ -101,7 +101,7 @@ public:
// vexing-parse
QString name( (QLatin1String(Interface::staticInterfaceName())) );
if (check == CheckInterfaceSupported && !mInterfaces.contains(name)) {
- return 0;
+ return nullptr;
}
// If present or forced, delegate to OptionalInterfaceFactory
@@ -111,7 +111,7 @@ public:
template <typename Interface>
inline Interface *interface() const
{
- AbstractInterface* interfaceMustBeASubclassOfAbstractInterface = static_cast<Interface *>(NULL);
+ AbstractInterface* interfaceMustBeASubclassOfAbstractInterface = static_cast<Interface *>(nullptr);
Q_UNUSED(interfaceMustBeASubclassOfAbstractInterface);
// If there is a interface cached already, return it
diff --git a/TelepathyQt/outgoing-dbus-tube-channel.h b/TelepathyQt/outgoing-dbus-tube-channel.h
index 89b6c78b..3f1feedd 100644
--- a/TelepathyQt/outgoing-dbus-tube-channel.h
+++ b/TelepathyQt/outgoing-dbus-tube-channel.h
@@ -41,7 +41,7 @@ public:
static OutgoingDBusTubeChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~OutgoingDBusTubeChannel();
+ ~OutgoingDBusTubeChannel() override;
PendingDBusTubeConnection *offerTube(const QVariantMap &parameters, bool allowOtherUsers = false);
diff --git a/TelepathyQt/outgoing-file-transfer-channel.cpp b/TelepathyQt/outgoing-file-transfer-channel.cpp
index 7ab17c8e..040455b6 100644
--- a/TelepathyQt/outgoing-file-transfer-channel.cpp
+++ b/TelepathyQt/outgoing-file-transfer-channel.cpp
@@ -56,14 +56,16 @@ struct TP_QT_NO_EXPORT OutgoingFileTransferChannel::Private
SocketAddressIPv4 addr;
qint64 pos;
+ bool weOpenedDevice;
};
OutgoingFileTransferChannel::Private::Private(OutgoingFileTransferChannel *parent)
: parent(parent),
fileTransferInterface(parent->interface<Client::ChannelTypeFileTransferInterface>()),
- input(0),
- socket(0),
- pos(0)
+ input(nullptr),
+ socket(nullptr),
+ pos(0),
+ weOpenedDevice(false)
{
}
@@ -180,8 +182,14 @@ PendingOperation *OutgoingFileTransferChannel::provideFile(QIODevice *input)
OutgoingFileTransferChannelPtr(this));
}
- if ((!input->isOpen() && !input->open(QIODevice::ReadOnly)) &&
- !input->isReadable()) {
+ if (!input->isOpen()) {
+ if (input->open(QIODevice::ReadOnly)) {
+ mPriv->weOpenedDevice = true;
+ }
+ }
+
+ if (!input->isReadable()) {
+ mPriv->weOpenedDevice = false;
warning() << "Unable to open IO device for reading";
return new PendingFailure(TP_QT_ERROR_PERMISSION_DENIED,
QLatin1String("Unable to open IO device for reading"),
@@ -230,6 +238,8 @@ void OutgoingFileTransferChannel::connectToHost()
return;
}
+ mPriv->pos = initialOffset();
+
mPriv->socket = new QTcpSocket(this);
connect(mPriv->socket, SIGNAL(connected()),
@@ -255,10 +265,8 @@ void OutgoingFileTransferChannel::onSocketConnected()
SLOT(doTransfer()));
// for non sequential devices, let's seek to the initialOffset
- if (!mPriv->input->isSequential()) {
- if (mPriv->input->seek(initialOffset())) {
- mPriv->pos = initialOffset();
- }
+ if (mPriv->weOpenedDevice && !mPriv->input->isSequential()) {
+ mPriv->input->seek(initialOffset());
}
debug() << "Starting transfer...";
@@ -306,6 +314,7 @@ void OutgoingFileTransferChannel::doTransfer()
qint64 skip = (qint64) qMin(initialOffset() - mPriv->pos,
(qulonglong) len);
+ mPriv->pos += skip;
debug() << "skipping" << skip << "bytes";
if (skip == len) {
// nothing to write, all data read was skipped
@@ -362,7 +371,10 @@ void OutgoingFileTransferChannel::setFinished()
this, SLOT(onInputAboutToClose()));
disconnect(mPriv->input, SIGNAL(readyRead()),
this, SLOT(doTransfer()));
- mPriv->input->close();
+
+ if (mPriv->weOpenedDevice) {
+ mPriv->input->close();
+ }
}
FileTransferChannel::setFinished();
diff --git a/TelepathyQt/outgoing-file-transfer-channel.h b/TelepathyQt/outgoing-file-transfer-channel.h
index 37daa842..5c1c47e0 100644
--- a/TelepathyQt/outgoing-file-transfer-channel.h
+++ b/TelepathyQt/outgoing-file-transfer-channel.h
@@ -45,7 +45,7 @@ public:
static OutgoingFileTransferChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~OutgoingFileTransferChannel();
+ ~OutgoingFileTransferChannel() override;
PendingOperation *provideFile(QIODevice *input);
@@ -65,8 +65,8 @@ private Q_SLOTS:
TP_QT_NO_EXPORT void doTransfer();
private:
- TP_QT_NO_EXPORT void connectToHost();
- TP_QT_NO_EXPORT void setFinished();
+ TP_QT_NO_EXPORT void connectToHost() override;
+ TP_QT_NO_EXPORT void setFinished() override;
struct Private;
friend struct Private;
diff --git a/TelepathyQt/outgoing-stream-tube-channel-internal.h b/TelepathyQt/outgoing-stream-tube-channel-internal.h
index 1480d9d3..157c5ebd 100644
--- a/TelepathyQt/outgoing-stream-tube-channel-internal.h
+++ b/TelepathyQt/outgoing-stream-tube-channel-internal.h
@@ -39,7 +39,7 @@ public:
PendingOpenTube(PendingVoid *offerOperation,
const QVariantMap &parameters,
const OutgoingStreamTubeChannelPtr &object);
- ~PendingOpenTube();
+ ~PendingOpenTube() override;
private Q_SLOTS:
void onTubeStateChanged(Tp::TubeChannelState state);
@@ -57,8 +57,8 @@ class TP_QT_NO_EXPORT QueuedContactFactory : public QObject
Q_DISABLE_COPY(QueuedContactFactory)
public:
- QueuedContactFactory(ContactManagerPtr contactManager, QObject* parent = 0);
- ~QueuedContactFactory();
+ QueuedContactFactory(ContactManagerPtr contactManager, QObject* parent = nullptr);
+ ~QueuedContactFactory() override;
QUuid appendNewRequest(const UIntList &handles);
diff --git a/TelepathyQt/outgoing-stream-tube-channel.cpp b/TelepathyQt/outgoing-stream-tube-channel.cpp
index 64e7c2fd..7dee3975 100644
--- a/TelepathyQt/outgoing-stream-tube-channel.cpp
+++ b/TelepathyQt/outgoing-stream-tube-channel.cpp
@@ -465,7 +465,7 @@ PendingOperation *OutgoingStreamTubeChannel::offerTcpSocket(
*
* This method requires OutgoingStreamTubeChannel::FeatureCore to be ready.
*
- * \param address A valid path to an existing Unix socket or abstract Unix socket.
+ * \param socketAddress A valid path to an existing Unix socket or abstract Unix socket.
* \param parameters A dictionary of arbitrary parameters to send with the tube offer.
* \param requireCredentials Whether the server requires a SCM_CREDS or SCM_CREDENTIALS message
* upon connection.
diff --git a/TelepathyQt/outgoing-stream-tube-channel.h b/TelepathyQt/outgoing-stream-tube-channel.h
index 0a89a97b..a0d75d4e 100644
--- a/TelepathyQt/outgoing-stream-tube-channel.h
+++ b/TelepathyQt/outgoing-stream-tube-channel.h
@@ -47,7 +47,7 @@ public:
static OutgoingStreamTubeChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~OutgoingStreamTubeChannel();
+ ~OutgoingStreamTubeChannel() override;
PendingOperation *offerTcpSocket(const QHostAddress &address, quint16 port,
const QVariantMap &parameters = QVariantMap());
diff --git a/TelepathyQt/pending-account.h b/TelepathyQt/pending-account.h
index 788d3464..8ca39234 100644
--- a/TelepathyQt/pending-account.h
+++ b/TelepathyQt/pending-account.h
@@ -46,7 +46,7 @@ class TP_QT_EXPORT PendingAccount : public PendingOperation
Q_DISABLE_COPY(PendingAccount);
public:
- ~PendingAccount();
+ ~PendingAccount() override;
AccountManagerPtr manager() const;
diff --git a/TelepathyQt/pending-captchas.h b/TelepathyQt/pending-captchas.h
index a9d5637f..1f71e2ba 100644
--- a/TelepathyQt/pending-captchas.h
+++ b/TelepathyQt/pending-captchas.h
@@ -44,7 +44,7 @@ class TP_QT_EXPORT PendingCaptchas : public PendingOperation
Q_DISABLE_COPY(PendingCaptchas)
public:
- virtual ~PendingCaptchas();
+ ~PendingCaptchas() override;
Captcha captcha() const;
QList<Captcha> captchaList() const;
diff --git a/TelepathyQt/pending-channel-request-internal.h b/TelepathyQt/pending-channel-request-internal.h
index 076e2b22..c67236ef 100644
--- a/TelepathyQt/pending-channel-request-internal.h
+++ b/TelepathyQt/pending-channel-request-internal.h
@@ -41,7 +41,7 @@ public:
{
}
- ~PendingChannelRequestCancelOperation()
+ ~PendingChannelRequestCancelOperation() override
{
}
diff --git a/TelepathyQt/pending-channel-request.cpp b/TelepathyQt/pending-channel-request.cpp
index 9775d293..e51009ef 100644
--- a/TelepathyQt/pending-channel-request.cpp
+++ b/TelepathyQt/pending-channel-request.cpp
@@ -46,7 +46,7 @@ struct TP_QT_NO_EXPORT PendingChannelRequest::Private
{
Private(const QDBusConnection &dbusConnection)
: dbusConnection(dbusConnection),
- cancelOperation(0)
+ cancelOperation(nullptr)
{
}
@@ -64,7 +64,7 @@ struct TP_QT_NO_EXPORT PendingChannelRequest::Private
* the reply to an asynchronous ChannelRequest request.
*
* Instances of this class cannot be constructed directly; the only way to get
- * one is trough Account.
+ * one is through Account.
*
* See \ref async_model
*/
@@ -96,7 +96,7 @@ PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
Client::ChannelDispatcherInterface *channelDispatcherInterface =
account->dispatcherInterface();
- QDBusPendingCallWatcher *watcher = 0;
+ QDBusPendingCallWatcher *watcher = nullptr;
if (create) {
if (hints.isValid()) {
if (account->supportsRequestHints()) {
@@ -104,7 +104,11 @@ PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
channelDispatcherInterface->CreateChannelWithHints(
QDBusObjectPath(account->objectPath()),
requestedProperties,
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
+#else
+ userActionTime.isNull() ? 0 : userActionTime.toSecsSinceEpoch(),
+#endif
preferredHandler, hints.allHints()), this);
} else {
warning() << "Hints passed to channel request won't have an effect"
@@ -117,7 +121,11 @@ PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
channelDispatcherInterface->CreateChannel(
QDBusObjectPath(account->objectPath()),
requestedProperties,
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
+#else
+ userActionTime.isNull() ? 0 : userActionTime.toSecsSinceEpoch(),
+#endif
preferredHandler), this);
}
} else {
@@ -127,7 +135,11 @@ PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
channelDispatcherInterface->EnsureChannelWithHints(
QDBusObjectPath(account->objectPath()),
requestedProperties,
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
+#else
+ userActionTime.isNull() ? 0 : userActionTime.toSecsSinceEpoch(),
+#endif
preferredHandler, hints.allHints()), this);
} else {
warning() << "Hints passed to channel request won't have an effect"
@@ -140,7 +152,11 @@ PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
channelDispatcherInterface->EnsureChannel(
QDBusObjectPath(account->objectPath()),
requestedProperties,
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
+#else
+ userActionTime.isNull() ? 0 : userActionTime.toSecsSinceEpoch(),
+#endif
preferredHandler), this);
}
}
@@ -266,7 +282,7 @@ void PendingChannelRequest::onProceedOperationFinished(PendingOperation *op)
void PendingChannelRequest::onCancelOperationFinished(PendingOperation *op)
{
- mPriv->cancelOperation = 0;
+ mPriv->cancelOperation = nullptr;
if (!isFinished()) {
setFinishedWithError(TP_QT_ERROR_CANCELLED,
QLatin1String("ChannelRequest cancelled"));
diff --git a/TelepathyQt/pending-channel-request.h b/TelepathyQt/pending-channel-request.h
index 1c62c21c..9e791695 100644
--- a/TelepathyQt/pending-channel-request.h
+++ b/TelepathyQt/pending-channel-request.h
@@ -49,7 +49,7 @@ class TP_QT_EXPORT PendingChannelRequest : public PendingOperation
Q_DISABLE_COPY(PendingChannelRequest)
public:
- ~PendingChannelRequest();
+ ~PendingChannelRequest() override;
AccountPtr account() const;
diff --git a/TelepathyQt/pending-channel.cpp b/TelepathyQt/pending-channel.cpp
index 74ddee4d..95d9bb80 100644
--- a/TelepathyQt/pending-channel.cpp
+++ b/TelepathyQt/pending-channel.cpp
@@ -70,7 +70,7 @@ public:
return AccountFactoryPtr(new FakeAccountFactory(account));
}
- ~FakeAccountFactory() { }
+ ~FakeAccountFactory() override { }
AccountPtr account() const { return mAccount; }
@@ -78,7 +78,7 @@ protected:
AccountPtr construct(const QString &busName, const QString &objectPath,
const ConnectionFactoryConstPtr &connFactory,
const ChannelFactoryConstPtr &chanFactory,
- const ContactFactoryConstPtr &contactFactory) const
+ const ContactFactoryConstPtr &contactFactory) const override
{
if (mAccount->objectPath() != objectPath) {
warning() << "Account received by the fake factory is different from original account";
@@ -126,7 +126,7 @@ PendingChannel::PendingChannel(const ConnectionPtr &connection, const QString &e
mPriv->yours = false;
mPriv->handleType = 0;
mPriv->handle = 0;
- mPriv->notifier = 0;
+ mPriv->notifier = nullptr;
mPriv->create = false;
setFinishedWithError(errorName, errorMessage);
@@ -149,7 +149,7 @@ PendingChannel::PendingChannel(const ConnectionPtr &connection,
mPriv->channelType = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType")).toString();
mPriv->handleType = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType")).toUInt();
mPriv->handle = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle")).toUInt();
- mPriv->notifier = 0;
+ mPriv->notifier = nullptr;
mPriv->create = create;
Client::ConnectionInterfaceRequestsInterface *requestsInterface =
@@ -187,7 +187,7 @@ PendingChannel::PendingChannel(const AccountPtr &account,
account->channelFactory(),
account->contactFactory());
mPriv->handler = RequestTemporaryHandler::create(account);
- mPriv->notifier = 0;
+ mPriv->notifier = nullptr;
mPriv->create = create;
QString handlerName = QString(QLatin1String("TpQtRaH_%1_%2"))
@@ -395,10 +395,10 @@ HandledChannelNotifier *PendingChannel::handledChannelNotifier() const
{
if (!isFinished()) {
warning() << "PendingChannel::handledChannelNotifier called before finished, returning 0";
- return 0;
+ return nullptr;
} else if (!isValid()) {
warning() << "PendingChannel::handledChannelNotifier called when not valid, returning 0";
- return 0;
+ return nullptr;
}
if (mPriv->cr && !mPriv->notifier) {
diff --git a/TelepathyQt/pending-channel.h b/TelepathyQt/pending-channel.h
index 2480e431..ce8be47e 100644
--- a/TelepathyQt/pending-channel.h
+++ b/TelepathyQt/pending-channel.h
@@ -47,7 +47,7 @@ class TP_QT_EXPORT PendingChannel : public PendingOperation
Q_DISABLE_COPY(PendingChannel)
public:
- ~PendingChannel();
+ ~PendingChannel() override;
ConnectionPtr connection() const;
diff --git a/TelepathyQt/pending-connection.h b/TelepathyQt/pending-connection.h
index 1f9c6c09..25f1e30d 100644
--- a/TelepathyQt/pending-connection.h
+++ b/TelepathyQt/pending-connection.h
@@ -46,7 +46,7 @@ class TP_QT_EXPORT PendingConnection : public PendingOperation
Q_DISABLE_COPY(PendingConnection);
public:
- ~PendingConnection();
+ ~PendingConnection() override;
ConnectionManagerPtr manager() const;
diff --git a/TelepathyQt/pending-contact-attributes.h b/TelepathyQt/pending-contact-attributes.h
index 2f1fa14a..fd410386 100644
--- a/TelepathyQt/pending-contact-attributes.h
+++ b/TelepathyQt/pending-contact-attributes.h
@@ -43,7 +43,7 @@ class TP_QT_EXPORT PendingContactAttributes : public PendingOperation
Q_DISABLE_COPY(PendingContactAttributes)
public:
- ~PendingContactAttributes();
+ ~PendingContactAttributes() override;
ConnectionPtr connection() const;
diff --git a/TelepathyQt/pending-contact-info.h b/TelepathyQt/pending-contact-info.h
index 15e0686e..7318808d 100644
--- a/TelepathyQt/pending-contact-info.h
+++ b/TelepathyQt/pending-contact-info.h
@@ -42,7 +42,7 @@ class TP_QT_EXPORT PendingContactInfo : public PendingOperation
Q_DISABLE_COPY(PendingContactInfo);
public:
- ~PendingContactInfo();
+ ~PendingContactInfo() override;
ContactPtr contact() const;
diff --git a/TelepathyQt/pending-contacts-internal.h b/TelepathyQt/pending-contacts-internal.h
index 75d97af9..7c9c5485 100644
--- a/TelepathyQt/pending-contacts-internal.h
+++ b/TelepathyQt/pending-contacts-internal.h
@@ -41,7 +41,7 @@ public:
PendingAddressingGetContacts(const ConnectionPtr &connection,
const QStringList &uris,
const QStringList &interfaces);
- ~PendingAddressingGetContacts();
+ ~PendingAddressingGetContacts() override;
UIntList validHandles() const { return mValidHandles; }
diff --git a/TelepathyQt/pending-contacts.cpp b/TelepathyQt/pending-contacts.cpp
index 94ac00fe..2dd2cd9a 100644
--- a/TelepathyQt/pending-contacts.cpp
+++ b/TelepathyQt/pending-contacts.cpp
@@ -54,7 +54,7 @@ struct TP_QT_NO_EXPORT PendingContacts::Private
satisfyingContacts(satisfyingContacts),
requestType(PendingContacts::ForHandles),
handles(handles),
- nested(0)
+ nested(nullptr)
{
}
@@ -66,7 +66,7 @@ struct TP_QT_NO_EXPORT PendingContacts::Private
missingFeatures(features),
requestType(type),
addresses(list),
- nested(0)
+ nested(nullptr)
{
if (type != PendingContacts::ForIdentifiers &&
type != PendingContacts::ForUris) {
@@ -83,7 +83,7 @@ struct TP_QT_NO_EXPORT PendingContacts::Private
requestType(PendingContacts::ForVCardAddresses),
addresses(vcardAddresses),
vcardField(vcardField),
- nested(0)
+ nested(nullptr)
{
}
@@ -95,7 +95,7 @@ struct TP_QT_NO_EXPORT PendingContacts::Private
features(features),
requestType(PendingContacts::Upgrade),
contactsToUpgrade(contactsToUpgrade),
- nested(0)
+ nested(nullptr)
{
}
@@ -611,7 +611,7 @@ void PendingContacts::onNestedFinished(PendingOperation *operation)
}
mPriv->contacts = mPriv->nested->contacts();
- mPriv->nested = 0;
+ mPriv->nested = nullptr;
mPriv->setFinished();
}
diff --git a/TelepathyQt/pending-contacts.h b/TelepathyQt/pending-contacts.h
index 9b5cdbd4..e595409b 100644
--- a/TelepathyQt/pending-contacts.h
+++ b/TelepathyQt/pending-contacts.h
@@ -49,7 +49,7 @@ class TP_QT_EXPORT PendingContacts : public PendingOperation
Q_DISABLE_COPY(PendingContacts);
public:
- ~PendingContacts();
+ ~PendingContacts() override;
ContactManagerPtr manager() const;
Features features() const;
diff --git a/TelepathyQt/pending-dbus-tube-connection.h b/TelepathyQt/pending-dbus-tube-connection.h
index f5412d93..5ee7c23d 100644
--- a/TelepathyQt/pending-dbus-tube-connection.h
+++ b/TelepathyQt/pending-dbus-tube-connection.h
@@ -39,7 +39,7 @@ class TP_QT_EXPORT PendingDBusTubeConnection : public PendingOperation
Q_DISABLE_COPY(PendingDBusTubeConnection)
public:
- virtual ~PendingDBusTubeConnection();
+ ~PendingDBusTubeConnection() override;
QString address() const;
diff --git a/TelepathyQt/pending-debug-message-list.h b/TelepathyQt/pending-debug-message-list.h
index 281b67f9..a2c6e2eb 100644
--- a/TelepathyQt/pending-debug-message-list.h
+++ b/TelepathyQt/pending-debug-message-list.h
@@ -37,7 +37,7 @@ class TP_QT_EXPORT PendingDebugMessageList : public Tp::PendingOperation
Q_DISABLE_COPY(PendingDebugMessageList)
public:
- virtual ~PendingDebugMessageList();
+ ~PendingDebugMessageList() override;
DebugMessageList result() const;
diff --git a/TelepathyQt/pending-handles.h b/TelepathyQt/pending-handles.h
index 4a5dc0c2..c3406010 100644
--- a/TelepathyQt/pending-handles.h
+++ b/TelepathyQt/pending-handles.h
@@ -49,7 +49,7 @@ class TP_QT_EXPORT PendingHandles : public PendingOperation
Q_DISABLE_COPY(PendingHandles)
public:
- ~PendingHandles();
+ ~PendingHandles() override;
ConnectionPtr connection() const;
diff --git a/TelepathyQt/pending-operation.h b/TelepathyQt/pending-operation.h
index 89eb77de..6331b0bf 100644
--- a/TelepathyQt/pending-operation.h
+++ b/TelepathyQt/pending-operation.h
@@ -48,7 +48,7 @@ class TP_QT_EXPORT PendingOperation : public QObject
Q_DISABLE_COPY(PendingOperation)
public:
- virtual ~PendingOperation();
+ ~PendingOperation() override;
bool isFinished() const;
diff --git a/TelepathyQt/pending-ready.h b/TelepathyQt/pending-ready.h
index 7d0627ae..c1a097a1 100644
--- a/TelepathyQt/pending-ready.h
+++ b/TelepathyQt/pending-ready.h
@@ -43,7 +43,7 @@ class TP_QT_EXPORT PendingReady: public PendingOperation
Q_DISABLE_COPY(PendingReady);
public:
- ~PendingReady();
+ ~PendingReady() override;
DBusProxyPtr proxy() const;
diff --git a/TelepathyQt/pending-send-message.h b/TelepathyQt/pending-send-message.h
index fb9a8a3a..585fb2b1 100644
--- a/TelepathyQt/pending-send-message.h
+++ b/TelepathyQt/pending-send-message.h
@@ -44,7 +44,7 @@ class TP_QT_EXPORT PendingSendMessage : public PendingOperation
Q_DISABLE_COPY(PendingSendMessage)
public:
- ~PendingSendMessage();
+ ~PendingSendMessage() override;
TextChannelPtr channel() const;
diff --git a/TelepathyQt/pending-stream-tube-connection.h b/TelepathyQt/pending-stream-tube-connection.h
index 2796e906..e27e3fae 100644
--- a/TelepathyQt/pending-stream-tube-connection.h
+++ b/TelepathyQt/pending-stream-tube-connection.h
@@ -46,7 +46,7 @@ class TP_QT_EXPORT PendingStreamTubeConnection : public PendingOperation
Q_DISABLE_COPY(PendingStreamTubeConnection)
public:
- virtual ~PendingStreamTubeConnection();
+ ~PendingStreamTubeConnection() override;
SocketAddressType addressType() const;
diff --git a/TelepathyQt/pending-string-list.h b/TelepathyQt/pending-string-list.h
index ddd29871..7e7fa319 100644
--- a/TelepathyQt/pending-string-list.h
+++ b/TelepathyQt/pending-string-list.h
@@ -42,7 +42,7 @@ class TP_QT_EXPORT PendingStringList : public PendingOperation
public:
PendingStringList(const SharedPtr<RefCounted> &object);
PendingStringList(QDBusPendingCall call, const SharedPtr<RefCounted> &object);
- ~PendingStringList();
+ ~PendingStringList() override;
QStringList result() const;
diff --git a/TelepathyQt/pending-string.h b/TelepathyQt/pending-string.h
index 4bddc56a..078e4bff 100644
--- a/TelepathyQt/pending-string.h
+++ b/TelepathyQt/pending-string.h
@@ -41,7 +41,7 @@ class TP_QT_EXPORT PendingString : public PendingOperation
public:
PendingString(QDBusPendingCall call, const SharedPtr<RefCounted> &object);
- ~PendingString();
+ ~PendingString() override;
QString result() const;
diff --git a/TelepathyQt/pending-variant-map.h b/TelepathyQt/pending-variant-map.h
index 035c2a87..1ccd8e1c 100644
--- a/TelepathyQt/pending-variant-map.h
+++ b/TelepathyQt/pending-variant-map.h
@@ -42,7 +42,7 @@ class TP_QT_EXPORT PendingVariantMap : public PendingOperation
public:
PendingVariantMap(QDBusPendingCall call, const SharedPtr<RefCounted> &object);
- ~PendingVariantMap();
+ ~PendingVariantMap() override;
QVariantMap result() const;
diff --git a/TelepathyQt/pending-variant.h b/TelepathyQt/pending-variant.h
index 0a4ff868..962a35a1 100644
--- a/TelepathyQt/pending-variant.h
+++ b/TelepathyQt/pending-variant.h
@@ -42,7 +42,7 @@ class TP_QT_EXPORT PendingVariant : public PendingOperation
public:
PendingVariant(QDBusPendingCall call, const SharedPtr<RefCounted> &object);
- ~PendingVariant();
+ ~PendingVariant() override;
QVariant result() const;
diff --git a/TelepathyQt/presence.h b/TelepathyQt/presence.h
index 31fd056a..7b97f7df 100644
--- a/TelepathyQt/presence.h
+++ b/TelepathyQt/presence.h
@@ -52,7 +52,7 @@ public:
static Presence hidden(const QString &statusMessage = QString());
static Presence offline(const QString &statusMessage = QString());
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
Presence &operator=(const Presence &other);
bool operator==(const Presence &other) const;
@@ -83,7 +83,7 @@ public:
CanHaveStatusMessage = 0x2,
AllFlags = MaySetOnSelf | CanHaveStatusMessage
};
- Q_DECLARE_FLAGS(SimpleStatusFlags, SimpleStatusFlag);
+ Q_DECLARE_FLAGS(SimpleStatusFlags, SimpleStatusFlag)
PresenceSpec();
PresenceSpec(const QString &status, const SimpleStatusSpec &spec);
@@ -103,7 +103,7 @@ public:
static PresenceSpec unknown(SimpleStatusFlags flags = CanHaveStatusMessage);
static PresenceSpec error(SimpleStatusFlags flags = CanHaveStatusMessage);
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
PresenceSpec &operator=(const PresenceSpec &other);
bool operator==(const PresenceSpec &other) const;
@@ -164,8 +164,8 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(PresenceSpec::SimpleStatusFlags)
} // Tp
-Q_DECLARE_METATYPE(Tp::Presence);
-Q_DECLARE_METATYPE(Tp::PresenceSpec);
-Q_DECLARE_METATYPE(Tp::PresenceSpecList);
+Q_DECLARE_METATYPE(Tp::Presence)
+Q_DECLARE_METATYPE(Tp::PresenceSpec)
+Q_DECLARE_METATYPE(Tp::PresenceSpecList)
#endif
diff --git a/TelepathyQt/profile-manager.h b/TelepathyQt/profile-manager.h
index c5566339..28098e22 100644
--- a/TelepathyQt/profile-manager.h
+++ b/TelepathyQt/profile-manager.h
@@ -51,7 +51,7 @@ public:
static ProfileManagerPtr create(const QDBusConnection &bus = QDBusConnection::sessionBus());
- ~ProfileManager();
+ ~ProfileManager() override;
QList<ProfilePtr> profiles() const;
QList<ProfilePtr> profilesForCM(const QString &cmName) const;
diff --git a/TelepathyQt/profile.cpp b/TelepathyQt/profile.cpp
index a67800f5..073e0cc3 100644
--- a/TelepathyQt/profile.cpp
+++ b/TelepathyQt/profile.cpp
@@ -104,12 +104,12 @@ public:
XmlHandler(const QString &serviceName, bool allowNonIMType, Profile::Private::Data *outputData);
bool startElement(const QString &namespaceURI, const QString &localName,
- const QString &qName, const QXmlAttributes &attributes);
+ const QString &qName, const QXmlAttributes &attributes) override;
bool endElement(const QString &namespaceURI, const QString &localName,
- const QString &qName);
- bool characters(const QString &str);
- bool fatalError(const QXmlParseException &exception);
- QString errorString() const;
+ const QString &qName) override;
+ bool characters(const QString &str) override;
+ bool fatalError(const QXmlParseException &exception) override;
+ QString errorString() const override;
private:
bool attributeValueAsBoolean(const QXmlAttributes &attributes,
@@ -527,7 +527,7 @@ void Profile::Private::invalidate()
* \brief The Profile class provides an easy way to read Telepathy profile
* files according to http://telepathy.freedesktop.org/wiki/service-profile-v1.
*
- * Note that profiles with xml element <type> different than "IM" are considered
+ * Note that profiles with xml element \<type\> different than "IM" are considered
* invalid.
*/
diff --git a/TelepathyQt/profile.h b/TelepathyQt/profile.h
index 916db28f..56ef8c6f 100644
--- a/TelepathyQt/profile.h
+++ b/TelepathyQt/profile.h
@@ -48,7 +48,7 @@ public:
static ProfilePtr createForServiceName(const QString &serviceName);
static ProfilePtr createForFileName(const QString &fileName);
- ~Profile();
+ ~Profile() override;
QString serviceName() const;
@@ -169,7 +169,7 @@ private:
} // Tp
-Q_DECLARE_METATYPE(Tp::Profile::Parameter);
-Q_DECLARE_METATYPE(Tp::Profile::Presence);
+Q_DECLARE_METATYPE(Tp::Profile::Parameter)
+Q_DECLARE_METATYPE(Tp::Profile::Presence)
#endif
diff --git a/TelepathyQt/protocol-info.cpp b/TelepathyQt/protocol-info.cpp
index 7eb2fb43..a488288b 100644
--- a/TelepathyQt/protocol-info.cpp
+++ b/TelepathyQt/protocol-info.cpp
@@ -34,7 +34,7 @@ struct TP_QT_NO_EXPORT ProtocolInfo::Private : public QSharedData
{
Private()
: dbusConnection(QDBusConnection::sessionBus()), // make the compiler happy
- addressingIface(0)
+ addressingIface(nullptr)
{
}
@@ -44,7 +44,7 @@ struct TP_QT_NO_EXPORT ProtocolInfo::Private : public QSharedData
cmName(cm->name()),
name(name),
iconName(QString(QLatin1String("im-%1")).arg(name)),
- addressingIface(0)
+ addressingIface(nullptr)
{
QString escapedProtocolName = name;
escapedProtocolName.replace(QLatin1Char('-'), QLatin1Char('_'));
diff --git a/TelepathyQt/protocol-info.h b/TelepathyQt/protocol-info.h
index 5828b368..7ca2a8b1 100644
--- a/TelepathyQt/protocol-info.h
+++ b/TelepathyQt/protocol-info.h
@@ -50,7 +50,7 @@ public:
ProtocolInfo(const ProtocolInfo &other);
~ProtocolInfo();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
ProtocolInfo &operator=(const ProtocolInfo &other);
@@ -105,7 +105,7 @@ typedef QList<ProtocolInfo> ProtocolInfoList;
} // Tp
-Q_DECLARE_METATYPE(Tp::ProtocolInfo);
-Q_DECLARE_METATYPE(Tp::ProtocolInfoList);
+Q_DECLARE_METATYPE(Tp::ProtocolInfo)
+Q_DECLARE_METATYPE(Tp::ProtocolInfoList)
#endif
diff --git a/TelepathyQt/protocol-parameter.h b/TelepathyQt/protocol-parameter.h
index 0762bb39..5b20428b 100644
--- a/TelepathyQt/protocol-parameter.h
+++ b/TelepathyQt/protocol-parameter.h
@@ -55,7 +55,7 @@ public:
ProtocolParameter(const ProtocolParameter &other);
~ProtocolParameter();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
ProtocolParameter &operator=(const ProtocolParameter &other);
bool operator==(const ProtocolParameter &other) const;
@@ -88,7 +88,7 @@ uint qHash(const ProtocolParameter &parameter);
} // Tp
-Q_DECLARE_METATYPE(Tp::ProtocolParameter);
-Q_DECLARE_METATYPE(Tp::ProtocolParameterList);
+Q_DECLARE_METATYPE(Tp::ProtocolParameter)
+Q_DECLARE_METATYPE(Tp::ProtocolParameterList)
#endif
diff --git a/TelepathyQt/readiness-helper.cpp b/TelepathyQt/readiness-helper.cpp
index c39fbf78..2e545a17 100644
--- a/TelepathyQt/readiness-helper.cpp
+++ b/TelepathyQt/readiness-helper.cpp
@@ -63,7 +63,7 @@ struct TP_QT_NO_EXPORT ReadinessHelper::Introspectable::Private : public QShared
};
ReadinessHelper::Introspectable::Introspectable()
- : mPriv(new Private(QSet<uint>(), Features(), QStringList(), 0, 0, false))
+ : mPriv(new Private(QSet<uint>(), Features(), QStringList(), nullptr, nullptr, false))
{
}
@@ -139,7 +139,7 @@ ReadinessHelper::Private::Private(
const Introspectables &introspectables)
: parent(parent),
object(object),
- proxy(0),
+ proxy(nullptr),
currentStatus(currentStatus),
introspectables(introspectables),
pendingStatusChange(false),
@@ -149,7 +149,7 @@ ReadinessHelper::Private::Private(
i != introspectables.constEnd(); ++i) {
Feature feature = i.key();
Introspectable introspectable = i.value();
- Q_ASSERT(introspectable.mPriv->introspectFunc != 0);
+ Q_ASSERT(introspectable.mPriv->introspectFunc != nullptr);
supportedStatuses += introspectable.mPriv->makesSenseForStatuses;
supportedFeatures += feature;
}
@@ -168,13 +168,13 @@ ReadinessHelper::Private::Private(
pendingStatusChange(false),
pendingStatus(-1)
{
- Q_ASSERT(proxy != 0);
+ Q_ASSERT(proxy != nullptr);
for (Introspectables::const_iterator i = introspectables.constBegin();
i != introspectables.constEnd(); ++i) {
Feature feature = i.key();
Introspectable introspectable = i.value();
- Q_ASSERT(introspectable.mPriv->introspectFunc != 0);
+ Q_ASSERT(introspectable.mPriv->introspectFunc != nullptr);
supportedStatuses += introspectable.mPriv->makesSenseForStatuses;
supportedFeatures += feature;
}
diff --git a/TelepathyQt/readiness-helper.h b/TelepathyQt/readiness-helper.h
index d570d172..b2cd55b7 100644
--- a/TelepathyQt/readiness-helper.h
+++ b/TelepathyQt/readiness-helper.h
@@ -33,6 +33,7 @@
#include <QSet>
#include <QSharedDataPointer>
#include <QStringList>
+#include <QObject>
class QDBusError;
@@ -78,12 +79,12 @@ public:
ReadinessHelper(RefCounted *object,
uint currentStatus = 0,
const Introspectables &introspectables = Introspectables(),
- QObject *parent = 0);
+ QObject *parent = nullptr);
ReadinessHelper(DBusProxy *proxy,
uint currentStatus = 0,
const Introspectables &introspectables = Introspectables(),
- QObject *parent = 0);
- ~ReadinessHelper();
+ QObject *parent = nullptr);
+ ~ReadinessHelper() override;
void addIntrospectables(const Introspectables &introspectables);
@@ -99,9 +100,9 @@ public:
Features missingFeatures() const;
bool isReady(const Feature &feature,
- QString *errorName = 0, QString *errorMessage = 0) const;
+ QString *errorName = nullptr, QString *errorMessage = nullptr) const;
bool isReady(const Features &features,
- QString *errorName = 0, QString *errorMessage = 0) const;
+ QString *errorName = nullptr, QString *errorMessage = nullptr) const;
PendingReady *becomeReady(const Features &requestedFeatures);
void setIntrospectCompleted(const Feature &feature, bool success,
diff --git a/TelepathyQt/referenced-handles.cpp b/TelepathyQt/referenced-handles.cpp
index 4ed8a5b5..8c3d991f 100644
--- a/TelepathyQt/referenced-handles.cpp
+++ b/TelepathyQt/referenced-handles.cpp
@@ -269,7 +269,11 @@ bool ReferencedHandles::removeOne(uint handle)
void ReferencedHandles::swap(int i, int j)
{
+#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
+ mPriv->handles.swapItemsAt(i, j);
+#else
mPriv->handles.swap(i, j);
+#endif
}
uint ReferencedHandles::takeAt(int i)
diff --git a/TelepathyQt/referenced-handles.h b/TelepathyQt/referenced-handles.h
index 71dd0e2f..7d27816e 100644
--- a/TelepathyQt/referenced-handles.h
+++ b/TelepathyQt/referenced-handles.h
@@ -259,6 +259,6 @@ typedef QListIterator<uint> ReferencedHandlesIterator;
} // Tp
-Q_DECLARE_METATYPE(Tp::ReferencedHandles);
+Q_DECLARE_METATYPE(Tp::ReferencedHandles)
#endif
diff --git a/TelepathyQt/request-temporary-handler-internal.h b/TelepathyQt/request-temporary-handler-internal.h
index 42f3f36d..3e53158f 100644
--- a/TelepathyQt/request-temporary-handler-internal.h
+++ b/TelepathyQt/request-temporary-handler-internal.h
@@ -37,7 +37,7 @@ class TP_QT_NO_EXPORT RequestTemporaryHandler : public QObject, public AbstractC
public:
static SharedPtr<RequestTemporaryHandler> create(const AccountPtr &account);
- ~RequestTemporaryHandler();
+ ~RequestTemporaryHandler() override;
AccountPtr account() const { return mAccount; }
ChannelPtr channel() const { return ChannelPtr(mChannel); }
@@ -50,7 +50,7 @@ public:
* first. Though if the CD isn't confused it shouldn't really matter - our filter
* is empty anyway.
*/
- bool bypassApproval() const { return false; }
+ bool bypassApproval() const override { return false; }
void handleChannels(const MethodInvocationContextPtr<> &context,
const AccountPtr &account,
@@ -58,7 +58,7 @@ public:
const QList<ChannelPtr> &channels,
const QList<ChannelRequestPtr> &requestsSatisfied,
const QDateTime &userActionTime,
- const HandlerInfo &handlerInfo);
+ const HandlerInfo &handlerInfo) override;
void setQueueChannelReceived(bool queue);
diff --git a/TelepathyQt/requestable-channel-class-spec.h b/TelepathyQt/requestable-channel-class-spec.h
index 1b78f775..abe376dc 100644
--- a/TelepathyQt/requestable-channel-class-spec.h
+++ b/TelepathyQt/requestable-channel-class-spec.h
@@ -71,7 +71,7 @@ public:
static RequestableChannelClassSpec dbusTube(const QString &serviceName = QString());
static RequestableChannelClassSpec streamTube(const QString &service = QString());
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
RequestableChannelClassSpec &operator=(const RequestableChannelClassSpec &other);
bool operator==(const RequestableChannelClassSpec &other) const;
@@ -134,7 +134,7 @@ public:
} // Tp
-Q_DECLARE_METATYPE(Tp::RequestableChannelClassSpec);
-Q_DECLARE_METATYPE(Tp::RequestableChannelClassSpecList);
+Q_DECLARE_METATYPE(Tp::RequestableChannelClassSpec)
+Q_DECLARE_METATYPE(Tp::RequestableChannelClassSpecList)
#endif
diff --git a/TelepathyQt/room-list-channel.h b/TelepathyQt/room-list-channel.h
index 1c9a47a6..0ee55e71 100644
--- a/TelepathyQt/room-list-channel.h
+++ b/TelepathyQt/room-list-channel.h
@@ -41,7 +41,7 @@ public:
static RoomListChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~RoomListChannel();
+ ~RoomListChannel() override;
protected:
RoomListChannel(const ConnectionPtr &connection, const QString &objectPath,
diff --git a/TelepathyQt/server-authentication-channel.h b/TelepathyQt/server-authentication-channel.h
index f6a97ec2..d6bdff01 100644
--- a/TelepathyQt/server-authentication-channel.h
+++ b/TelepathyQt/server-authentication-channel.h
@@ -43,7 +43,7 @@ public:
static ServerAuthenticationChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~ServerAuthenticationChannel();
+ ~ServerAuthenticationChannel() override;
CaptchaAuthenticationPtr captchaAuthentication() const;
diff --git a/TelepathyQt/service-types.h b/TelepathyQt/service-types.h
index 33adbf69..77443118 100644
--- a/TelepathyQt/service-types.h
+++ b/TelepathyQt/service-types.h
@@ -32,50 +32,96 @@
namespace Tp
{
-class AbstractProtocolInterface;
-class AbstractConnectionInterface;
+class AbstractCallContentInterface;
class AbstractChannelInterface;
+class AbstractConnectionInterface;
+class AbstractProtocolInterface;
+class BaseCallContent;
+class BaseCallContentDTMFInterface;
+class BaseCallMuteInterface;
+class BaseChannel;
+class BaseChannelCallType;
+class BaseChannelCaptchaAuthenticationInterface;
+class BaseChannelChatStateInterface;
+class BaseChannelConferenceInterface;
+class BaseChannelFileTransferType;
+class BaseChannelGroupInterface;
+class BaseChannelHoldInterface;
+class BaseChannelMergeableConferenceInterface;
+class BaseChannelMessagesInterface;
+class BaseChannelRoomConfigInterface;
+class BaseChannelRoomInterface;
+class BaseChannelRoomListType;
+class BaseChannelSASLAuthenticationInterface;
+class BaseChannelSMSInterface;
+class BaseChannelSecurableInterface;
+class BaseChannelServerAuthenticationType;
+class BaseChannelSplittableInterface;
+class BaseChannelTextType;
class BaseConnection;
-class BaseConnectionRequestsInterface;
-class BaseConnectionContactsInterface;
-class BaseConnectionSimplePresenceInterface;
-class BaseConnectionContactListInterface;
class BaseConnectionAddressingInterface;
+class BaseConnectionAliasingInterface;
+class BaseConnectionAvatarsInterface;
+class BaseConnectionClientTypesInterface;
+class BaseConnectionContactCapabilitiesInterface;
+class BaseConnectionContactGroupsInterface;
+class BaseConnectionContactInfoInterface;
+class BaseConnectionContactListInterface;
+class BaseConnectionContactsInterface;
class BaseConnectionManager;
+class BaseConnectionRequestsInterface;
+class BaseConnectionSimplePresenceInterface;
class BaseProtocol;
class BaseProtocolAddressingInterface;
class BaseProtocolAvatarsInterface;
class BaseProtocolPresenceInterface;
-class BaseChannel;
-class BaseChannelTextType;
-class BaseChannelMessagesInterface;
-class BaseChannelServerAuthenticationType;
-class BaseChannelCaptchaAuthenticationInterface;
-class BaseChannelGroupInterface;
class DBusService;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-typedef SharedPtr<AbstractProtocolInterface> AbstractProtocolInterfacePtr;
-typedef SharedPtr<AbstractConnectionInterface> AbstractConnectionInterfacePtr;
+typedef SharedPtr<AbstractCallContentInterface> AbstractCallContentInterfacePtr;
typedef SharedPtr<AbstractChannelInterface> AbstractChannelInterfacePtr;
+typedef SharedPtr<AbstractConnectionInterface> AbstractConnectionInterfacePtr;
+typedef SharedPtr<AbstractProtocolInterface> AbstractProtocolInterfacePtr;
+typedef SharedPtr<BaseCallContent> BaseCallContentPtr;
+typedef SharedPtr<BaseCallContentDTMFInterface> BaseCallContentDTMFInterfacePtr;
+typedef SharedPtr<BaseCallMuteInterface> BaseCallMuteInterfacePtr;
+typedef SharedPtr<BaseChannel> BaseChannelPtr;
+typedef SharedPtr<BaseChannelCallType> BaseChannelCallTypePtr;
+typedef SharedPtr<BaseChannelCaptchaAuthenticationInterface> BaseChannelCaptchaAuthenticationInterfacePtr;
+typedef SharedPtr<BaseChannelChatStateInterface> BaseChannelChatStateInterfacePtr;
+typedef SharedPtr<BaseChannelConferenceInterface> BaseChannelConferenceInterfacePtr;
+typedef SharedPtr<BaseChannelFileTransferType> BaseChannelFileTransferTypePtr;
+typedef SharedPtr<BaseChannelGroupInterface> BaseChannelGroupInterfacePtr;
+typedef SharedPtr<BaseChannelHoldInterface> BaseChannelHoldInterfacePtr;
+typedef SharedPtr<BaseChannelMergeableConferenceInterface> BaseChannelMergeableConferenceInterfacePtr;
+typedef SharedPtr<BaseChannelMessagesInterface> BaseChannelMessagesInterfacePtr;
+typedef SharedPtr<BaseChannelRoomConfigInterface> BaseChannelRoomConfigInterfacePtr;
+typedef SharedPtr<BaseChannelRoomInterface> BaseChannelRoomInterfacePtr;
+typedef SharedPtr<BaseChannelRoomListType> BaseChannelRoomListTypePtr;
+typedef SharedPtr<BaseChannelSASLAuthenticationInterface> BaseChannelSASLAuthenticationInterfacePtr;
+typedef SharedPtr<BaseChannelSMSInterface> BaseChannelSMSInterfacePtr;
+typedef SharedPtr<BaseChannelSecurableInterface> BaseChannelSecurableInterfacePtr;
+typedef SharedPtr<BaseChannelServerAuthenticationType> BaseChannelServerAuthenticationTypePtr;
+typedef SharedPtr<BaseChannelSplittableInterface> BaseChannelSplittableInterfacePtr;
+typedef SharedPtr<BaseChannelTextType> BaseChannelTextTypePtr;
typedef SharedPtr<BaseConnection> BaseConnectionPtr;
-typedef SharedPtr<BaseConnectionRequestsInterface> BaseConnectionRequestsInterfacePtr;
-typedef SharedPtr<BaseConnectionContactsInterface> BaseConnectionContactsInterfacePtr;
-typedef SharedPtr<BaseConnectionSimplePresenceInterface> BaseConnectionSimplePresenceInterfacePtr;
-typedef SharedPtr<BaseConnectionContactListInterface> BaseConnectionContactListInterfacePtr;
typedef SharedPtr<BaseConnectionAddressingInterface> BaseConnectionAddressingInterfacePtr;
+typedef SharedPtr<BaseConnectionAliasingInterface> BaseConnectionAliasingInterfacePtr;
+typedef SharedPtr<BaseConnectionAvatarsInterface> BaseConnectionAvatarsInterfacePtr;
+typedef SharedPtr<BaseConnectionClientTypesInterface> BaseConnectionClientTypesInterfacePtr;
+typedef SharedPtr<BaseConnectionContactCapabilitiesInterface> BaseConnectionContactCapabilitiesInterfacePtr;
+typedef SharedPtr<BaseConnectionContactGroupsInterface> BaseConnectionContactGroupsInterfacePtr;
+typedef SharedPtr<BaseConnectionContactInfoInterface> BaseConnectionContactInfoInterfacePtr;
+typedef SharedPtr<BaseConnectionContactListInterface> BaseConnectionContactListInterfacePtr;
+typedef SharedPtr<BaseConnectionContactsInterface> BaseConnectionContactsInterfacePtr;
typedef SharedPtr<BaseConnectionManager> BaseConnectionManagerPtr;
+typedef SharedPtr<BaseConnectionRequestsInterface> BaseConnectionRequestsInterfacePtr;
+typedef SharedPtr<BaseConnectionSimplePresenceInterface> BaseConnectionSimplePresenceInterfacePtr;
typedef SharedPtr<BaseProtocol> BaseProtocolPtr;
typedef SharedPtr<BaseProtocolAddressingInterface> BaseProtocolAddressingInterfacePtr;
typedef SharedPtr<BaseProtocolAvatarsInterface> BaseProtocolAvatarsInterfacePtr;
typedef SharedPtr<BaseProtocolPresenceInterface> BaseProtocolPresenceInterfacePtr;
-typedef SharedPtr<BaseChannel> BaseChannelPtr;
-typedef SharedPtr<BaseChannelTextType> BaseChannelTextTypePtr;
-typedef SharedPtr<BaseChannelMessagesInterface> BaseChannelMessagesInterfacePtr;
-typedef SharedPtr<BaseChannelServerAuthenticationType> BaseChannelServerAuthenticationTypePtr;
-typedef SharedPtr<BaseChannelCaptchaAuthenticationInterface> BaseChannelCaptchaAuthenticationInterfacePtr;
-typedef SharedPtr<BaseChannelGroupInterface> BaseChannelGroupInterfacePtr;
typedef SharedPtr<DBusService> DBusServicePtr;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
diff --git a/TelepathyQt/shared-ptr.h b/TelepathyQt/shared-ptr.h
index 2290f221..815e9c05 100644
--- a/TelepathyQt/shared-ptr.h
+++ b/TelepathyQt/shared-ptr.h
@@ -71,7 +71,7 @@ public:
inline virtual ~RefCounted()
{
- sc->d = 0;
+ sc->d = nullptr;
if (!sc->weakref.deref()) {
delete sc;
}
@@ -98,7 +98,7 @@ class SharedPtr
typedef bool (SharedPtr<T>::*UnspecifiedBoolType)() const;
public:
- inline SharedPtr() : d(0) { }
+ inline SharedPtr() : d(nullptr) { }
explicit inline SharedPtr(T *d) : d(d) { if (d) { d->ref(); } }
template <typename Subclass>
inline SharedPtr(const SharedPtr<Subclass> &o) : d(o.data()) { if (d) { d->ref(); } }
@@ -122,12 +122,12 @@ public:
if (tmp > 0) {
d = dynamic_cast<T*>(sc->d);
- Q_ASSERT(d != NULL);
+ Q_ASSERT(d != nullptr);
} else {
- d = 0;
+ d = nullptr;
}
} else {
- d = 0;
+ d = nullptr;
}
}
@@ -135,7 +135,7 @@ public:
{
if (d && !d->deref()) {
T *saved = d;
- d = 0;
+ d = nullptr;
delete saved;
}
}
@@ -152,7 +152,7 @@ public:
inline bool isNull() const { return !d; }
inline bool operator!() const { return isNull(); }
- operator UnspecifiedBoolType() const { return !isNull() ? &SharedPtr<T>::operator! : 0; }
+ operator UnspecifiedBoolType() const { return !isNull() ? &SharedPtr<T>::operator! : nullptr; }
inline bool operator==(const SharedPtr<T> &o) const { return d == o.d; }
inline bool operator!=(const SharedPtr<T> &o) const { return d != o.d; }
@@ -216,14 +216,14 @@ class WeakPtr
typedef bool (WeakPtr<T>::*UnspecifiedBoolType)() const;
public:
- inline WeakPtr() : sc(0) { }
+ inline WeakPtr() : sc(nullptr) { }
explicit inline WeakPtr(T *d)
{
if (d) {
sc = d->sc;
sc->weakref.ref();
} else {
- sc = 0;
+ sc = nullptr;
}
}
inline WeakPtr(const WeakPtr<T> &o) : sc(o.sc) { if (sc) { sc->weakref.ref(); } }
@@ -233,7 +233,7 @@ public:
sc = o.d->sc;
sc->weakref.ref();
} else {
- sc = 0;
+ sc = nullptr;
}
}
inline ~WeakPtr()
@@ -245,7 +245,7 @@ public:
inline bool isNull() const { return !sc || sc->strongref.fetchAndAddOrdered(0) <= 0; }
inline bool operator!() const { return isNull(); }
- operator UnspecifiedBoolType() const { return !isNull() ? &WeakPtr<T>::operator! : 0; }
+ operator UnspecifiedBoolType() const { return !isNull() ? &WeakPtr<T>::operator! : nullptr; }
inline WeakPtr<T> &operator=(const WeakPtr<T> &o)
{
diff --git a/TelepathyQt/simple-call-observer.h b/TelepathyQt/simple-call-observer.h
index e9464086..af830a59 100644
--- a/TelepathyQt/simple-call-observer.h
+++ b/TelepathyQt/simple-call-observer.h
@@ -57,7 +57,7 @@ public:
const QString &contactIdentifier,
CallDirection direction = CallDirectionBoth);
- virtual ~SimpleCallObserver();
+ ~SimpleCallObserver() override;
AccountPtr account() const;
QString contactIdentifier() const;
diff --git a/TelepathyQt/simple-observer-internal.h b/TelepathyQt/simple-observer-internal.h
index 82ceb3dd..91e029ae 100644
--- a/TelepathyQt/simple-observer-internal.h
+++ b/TelepathyQt/simple-observer-internal.h
@@ -83,7 +83,7 @@ public:
return SharedPtr<FakeAccountFactory>(new FakeAccountFactory(bus));
}
- ~FakeAccountFactory() { }
+ ~FakeAccountFactory() override { }
private:
friend class Observer;
@@ -96,7 +96,7 @@ private:
AccountPtr construct(const QString &busName, const QString &objectPath,
const ConnectionFactoryConstPtr &connFactory,
const ChannelFactoryConstPtr &chanFactory,
- const ContactFactoryConstPtr &contactFactory) const
+ const ContactFactoryConstPtr &contactFactory) const override
{
if (mAccounts.contains(objectPath)) {
return mAccounts.value(objectPath);
@@ -142,7 +142,7 @@ public:
const SharedPtr<FakeAccountFactory> &fakeAccountFactory,
const ChannelClassSpecList &channelFilter,
const QString &observerName);
- ~Observer();
+ ~Observer() override;
WeakPtr<ClientRegistrar> clientRegistrar() const { return mCr; }
SharedPtr<FakeAccountFactory> fakeAccountFactory() const { return mFakeAccountFactory; }
@@ -171,7 +171,7 @@ public:
const QList<ChannelPtr> &channels,
const ChannelDispatchOperationPtr &dispatchOperation,
const QList<ChannelRequestPtr> &requestsSatisfied,
- const ObserverInfo &observerInfo);
+ const ObserverInfo &observerInfo) override;
Q_SIGNALS:
void newChannels(const Tp::AccountPtr &channelsAccount, const QList<Tp::ChannelPtr> &channels);
@@ -205,7 +205,7 @@ class TP_QT_NO_EXPORT SimpleObserver::Private::ChannelWrapper :
public:
ChannelWrapper(const AccountPtr &channelAccount, const ChannelPtr &channel,
const Features &extraChannelFeatures, QObject *parent);
- ~ChannelWrapper() { }
+ ~ChannelWrapper() override { }
AccountPtr channelAccount() const { return mChannelAccount; }
ChannelPtr channel() const { return mChannel; }
diff --git a/TelepathyQt/simple-observer.cpp b/TelepathyQt/simple-observer.cpp
index e34f31c0..c8765fce 100644
--- a/TelepathyQt/simple-observer.cpp
+++ b/TelepathyQt/simple-observer.cpp
@@ -592,7 +592,7 @@ void SimpleObserver::onContactConstructed(Tp::PendingOperation *op)
mPriv->processChannelsQueue();
// disconnect all account signals we are handling
- disconnect(mPriv->account.data(), 0, this, 0);
+ disconnect(mPriv->account.data(), nullptr, this, nullptr);
}
void SimpleObserver::onNewChannels(const AccountPtr &channelsAccount,
diff --git a/TelepathyQt/simple-observer.h b/TelepathyQt/simple-observer.h
index e460d747..fd07094a 100644
--- a/TelepathyQt/simple-observer.h
+++ b/TelepathyQt/simple-observer.h
@@ -55,7 +55,7 @@ public:
const QList<ChannelClassFeatures> &extraChannelFeatures =
QList<ChannelClassFeatures>());
- virtual ~SimpleObserver();
+ ~SimpleObserver() override;
AccountPtr account() const;
ChannelClassSpecList channelFilter() const;
diff --git a/TelepathyQt/simple-pending-operations.h b/TelepathyQt/simple-pending-operations.h
index dce87852..0f78f8b9 100644
--- a/TelepathyQt/simple-pending-operations.h
+++ b/TelepathyQt/simple-pending-operations.h
@@ -94,7 +94,7 @@ public:
PendingComposite(const QList<PendingOperation*> &operations, const SharedPtr<RefCounted> &object);
PendingComposite(const QList<PendingOperation*> &operations, bool failOnFirstError,
const SharedPtr<RefCounted> &object);
- ~PendingComposite();
+ ~PendingComposite() override ;
private Q_SLOTS:
TP_QT_NO_EXPORT void onOperationFinished(Tp::PendingOperation *);
diff --git a/TelepathyQt/simple-stream-tube-handler.cpp b/TelepathyQt/simple-stream-tube-handler.cpp
index d1ab9e00..8772d178 100644
--- a/TelepathyQt/simple-stream-tube-handler.cpp
+++ b/TelepathyQt/simple-stream-tube-handler.cpp
@@ -157,10 +157,10 @@ void SimpleStreamTubeHandler::handleChannels(
if (invocation->tubes.isEmpty()) {
warning() << "SSTH::HandleChannels got no suitable channels, admitting we're Confused";
- invocation->readyOp = 0;
+ invocation->readyOp = nullptr;
invocation->error = TP_QT_ERROR_CONFUSED;
invocation->message = QLatin1String("Got no suitable channels");
- onReadyOpFinished(0);
+ onReadyOpFinished(nullptr);
} else {
invocation->readyOp = new PendingComposite(readyOps, SharedPtr<SimpleStreamTubeHandler>(this));
connect(invocation->readyOp,
@@ -175,12 +175,12 @@ void SimpleStreamTubeHandler::onReadyOpFinished(Tp::PendingOperation *op)
Q_ASSERT(!op || op->isFinished());
for (QLinkedList<SharedPtr<InvocationData> >::iterator i = mInvocations.begin();
- op != 0 && i != mInvocations.end(); ++i) {
+ op != nullptr && i != mInvocations.end(); ++i) {
if ((*i)->readyOp != op) {
continue;
}
- (*i)->readyOp = 0;
+ (*i)->readyOp = nullptr;
if (op->isError()) {
warning() << "Preparing proxies for SSTubeHandler failed with" << op->errorName()
diff --git a/TelepathyQt/simple-stream-tube-handler.h b/TelepathyQt/simple-stream-tube-handler.h
index d5b78dcb..83b0b89d 100644
--- a/TelepathyQt/simple-stream-tube-handler.h
+++ b/TelepathyQt/simple-stream-tube-handler.h
@@ -52,14 +52,14 @@ public:
bool requested,
bool monitorConnections,
bool bypassApproval = false);
- ~SimpleStreamTubeHandler();
+ ~SimpleStreamTubeHandler() override;
bool monitorsConnections() const
{
return mMonitorConnections;
}
- bool bypassApproval() const
+ bool bypassApproval() const override
{
return mBypassApproval;
}
@@ -70,7 +70,7 @@ public:
const QList<ChannelPtr> &channels,
const QList<ChannelRequestPtr> &requestsSatisfied,
const QDateTime &userActionTime,
- const HandlerInfo &handlerInfo);
+ const HandlerInfo &handlerInfo) override;
Q_SIGNALS:
void invokedForTube(
@@ -99,7 +99,7 @@ private:
bool mMonitorConnections;
struct InvocationData : RefCounted {
- InvocationData() : readyOp(0) {}
+ InvocationData() : readyOp(nullptr) {}
PendingOperation *readyOp;
QString error, message;
diff --git a/TelepathyQt/simple-text-observer-internal.h b/TelepathyQt/simple-text-observer-internal.h
index 91b5e1d9..b5203af8 100644
--- a/TelepathyQt/simple-text-observer-internal.h
+++ b/TelepathyQt/simple-text-observer-internal.h
@@ -51,7 +51,7 @@ class TP_QT_NO_EXPORT SimpleTextObserver::Private::TextChannelWrapper :
public:
TextChannelWrapper(const Tp::TextChannelPtr &channel);
- ~TextChannelWrapper() { }
+ ~TextChannelWrapper() override { }
Q_SIGNALS:
void channelMessageSent(const Tp::Message &message, Tp::MessageSendingFlags flags,
diff --git a/TelepathyQt/simple-text-observer.h b/TelepathyQt/simple-text-observer.h
index 87b16736..0c0ee211 100644
--- a/TelepathyQt/simple-text-observer.h
+++ b/TelepathyQt/simple-text-observer.h
@@ -47,7 +47,7 @@ public:
static SimpleTextObserverPtr create(const AccountPtr &account,
const QString &contactIdentifier);
- virtual ~SimpleTextObserver();
+ ~SimpleTextObserver() override;
AccountPtr account() const;
QString contactIdentifier() const;
diff --git a/TelepathyQt/stable-interfaces.xml b/TelepathyQt/stable-interfaces.xml
index d78879a7..4a4883ba 100644
--- a/TelepathyQt/stable-interfaces.xml
+++ b/TelepathyQt/stable-interfaces.xml
@@ -25,6 +25,8 @@
<xi:include href="call-content-media-description.xml"/>
<xi:include href="call-stream.xml"/>
<xi:include href="call-stream-endpoint.xml"/>
+<xi:include href="call-interfaces.xml"/>
+
<xi:include href="../spec/generic-types.xml"/>
<xi:include href="../spec/errors.xml"/>
diff --git a/TelepathyQt/stream-tube-channel.h b/TelepathyQt/stream-tube-channel.h
index 1f3b6f7d..83f6fa1e 100644
--- a/TelepathyQt/stream-tube-channel.h
+++ b/TelepathyQt/stream-tube-channel.h
@@ -45,7 +45,7 @@ public:
static StreamTubeChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~StreamTubeChannel();
+ ~StreamTubeChannel() override;
QString service() const;
diff --git a/TelepathyQt/stream-tube-client-internal.h b/TelepathyQt/stream-tube-client-internal.h
index b190e816..1d659583 100644
--- a/TelepathyQt/stream-tube-client-internal.h
+++ b/TelepathyQt/stream-tube-client-internal.h
@@ -39,7 +39,7 @@ public:
const QHostAddress &sourceAddress, quint16 sourcePort, StreamTubeClient *parent);
TubeWrapper(const AccountPtr &acc, const IncomingStreamTubeChannelPtr &tube,
bool requireCredentials, StreamTubeClient *parent);
- ~TubeWrapper() { }
+ ~TubeWrapper() override { }
AccountPtr mAcc;
IncomingStreamTubeChannelPtr mTube;
diff --git a/TelepathyQt/stream-tube-client.cpp b/TelepathyQt/stream-tube-client.cpp
index 9716a346..0edd0636 100644
--- a/TelepathyQt/stream-tube-client.cpp
+++ b/TelepathyQt/stream-tube-client.cpp
@@ -204,7 +204,7 @@ struct TP_QT_NO_EXPORT StreamTubeClient::Private
clientName(maybeClientName),
isRegistered(false),
acceptsAsTcp(false), acceptsAsUnix(false),
- tcpGenerator(0), requireCredentials(false)
+ tcpGenerator(nullptr), requireCredentials(false)
{
if (clientName.isEmpty()) {
clientName = QString::fromLatin1("TpQtSTubeClient_%1_%2")
@@ -648,7 +648,7 @@ StreamTubeClient::TcpSourceAddressGenerator *StreamTubeClient::tcpGenerator() co
{
if (!acceptsAsTcp()) {
warning() << "StreamTubeClient::tcpGenerator() used, but not accepting as TCP, returning 0";
- return 0;
+ return nullptr;
}
return mPriv->tcpGenerator;
@@ -735,7 +735,7 @@ void StreamTubeClient::setToAcceptAsTcp(TcpSourceAddressGenerator *generator)
*/
void StreamTubeClient::setToAcceptAsUnix(bool requireCredentials)
{
- mPriv->tcpGenerator = 0;
+ mPriv->tcpGenerator = nullptr;
mPriv->acceptsAsTcp = false;
mPriv->acceptsAsUnix = true;
mPriv->requireCredentials = requireCredentials;
@@ -826,7 +826,7 @@ void StreamTubeClient::onInvokedForTube(
return;
}
- TubeWrapper *wrapper = 0;
+ TubeWrapper *wrapper = nullptr;
if (mPriv->acceptsAsTcp) {
QPair<QHostAddress, quint16> srcAddr =
@@ -865,8 +865,8 @@ void StreamTubeClient::onInvokedForTube(
void StreamTubeClient::onAcceptFinished(TubeWrapper *wrapper, PendingStreamTubeConnection *conn)
{
- Q_ASSERT(wrapper != NULL);
- Q_ASSERT(conn != NULL);
+ Q_ASSERT(wrapper != nullptr);
+ Q_ASSERT(conn != nullptr);
if (!mPriv->tubes.contains(wrapper->mTube)) {
debug() << "StreamTubeClient ignoring Accept result for invalidated tube"
diff --git a/TelepathyQt/stream-tube-client.h b/TelepathyQt/stream-tube-client.h
index 3d3f32ac..09db4637 100644
--- a/TelepathyQt/stream-tube-client.h
+++ b/TelepathyQt/stream-tube-client.h
@@ -64,7 +64,7 @@ public:
Tube(const Tube &other);
~Tube();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
Tube &operator=(const Tube &other);
@@ -127,7 +127,7 @@ public:
bool monitorConnections = false,
bool bypassApproval = false);
- virtual ~StreamTubeClient();
+ ~StreamTubeClient() override;
ClientRegistrarPtr registrar() const;
QString clientName() const;
@@ -138,7 +138,7 @@ public:
TcpSourceAddressGenerator *tcpGenerator() const;
bool acceptsAsUnix() const;
- void setToAcceptAsTcp(TcpSourceAddressGenerator *generator = 0);
+ void setToAcceptAsTcp(TcpSourceAddressGenerator *generator = nullptr);
void setToAcceptAsUnix(bool requireCredentials = false);
QList<Tube> tubes() const;
diff --git a/TelepathyQt/stream-tube-server-internal.h b/TelepathyQt/stream-tube-server-internal.h
index 224f4b1e..c2a66184 100644
--- a/TelepathyQt/stream-tube-server-internal.h
+++ b/TelepathyQt/stream-tube-server-internal.h
@@ -36,7 +36,7 @@ public:
TubeWrapper(const AccountPtr &acc, const OutgoingStreamTubeChannelPtr &tube,
const QHostAddress &exportedAddr, quint16 exportedPort, const QVariantMap &params,
StreamTubeServer *parent);
- ~TubeWrapper() { }
+ ~TubeWrapper() override { }
AccountPtr mAcc;
OutgoingStreamTubeChannelPtr mTube;
diff --git a/TelepathyQt/stream-tube-server.cpp b/TelepathyQt/stream-tube-server.cpp
index 8aaaff4b..a4214a3c 100644
--- a/TelepathyQt/stream-tube-server.cpp
+++ b/TelepathyQt/stream-tube-server.cpp
@@ -90,7 +90,7 @@ public:
FixedParametersGenerator(const QVariantMap &params) : mParams(params) {}
QVariantMap nextParameters(const AccountPtr &, const OutgoingStreamTubeChannelPtr &,
- const ChannelRequestHints &)
+ const ChannelRequestHints &) override
{
return mParams;
}
@@ -300,7 +300,7 @@ struct StreamTubeServer::Private
clientName(maybeClientName),
isRegistered(false),
exportedPort(0),
- generator(0)
+ generator(nullptr)
{
if (clientName.isEmpty()) {
clientName = QString::fromLatin1("TpQtSTubeServer_%1_%2")
@@ -730,7 +730,7 @@ void StreamTubeServer::exportTcpSocket(
mPriv->exportedAddr = address;
mPriv->exportedPort = port;
- mPriv->generator = 0;
+ mPriv->generator = nullptr;
if (!parameters.isEmpty()) {
mPriv->fixedGenerator.reset(new FixedParametersGenerator(parameters));
mPriv->generator = mPriv->fixedGenerator.data();
diff --git a/TelepathyQt/stream-tube-server.h b/TelepathyQt/stream-tube-server.h
index 670b4a5f..eeb57de3 100644
--- a/TelepathyQt/stream-tube-server.h
+++ b/TelepathyQt/stream-tube-server.h
@@ -67,7 +67,7 @@ public:
RemoteContact(const RemoteContact &other);
~RemoteContact();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
RemoteContact &operator=(const RemoteContact &other);
@@ -95,7 +95,7 @@ public:
Tube(const Tube &other);
~Tube();
- bool isValid() const { return mPriv.constData() != 0; }
+ bool isValid() const { return mPriv.constData() != nullptr; }
Tube &operator=(const Tube &other);
@@ -154,7 +154,7 @@ public:
const QString &clientName = QString(),
bool monitorConnections = false);
- virtual ~StreamTubeServer();
+ ~StreamTubeServer() override;
ClientRegistrarPtr registrar() const;
QString clientName() const;
diff --git a/TelepathyQt/streamed-media-channel.h b/TelepathyQt/streamed-media-channel.h
index ca7bbf38..96329910 100644
--- a/TelepathyQt/streamed-media-channel.h
+++ b/TelepathyQt/streamed-media-channel.h
@@ -46,7 +46,7 @@ class TP_QT_EXPORT_DEPRECATED PendingStreamedMediaStreams : public PendingOperat
Q_DISABLE_COPY(PendingStreamedMediaStreams)
public:
- ~PendingStreamedMediaStreams();
+ ~PendingStreamedMediaStreams() override;
StreamedMediaChannelPtr channel() const;
@@ -82,7 +82,7 @@ public:
SendingStateSending = 2
};
- ~StreamedMediaStream();
+ ~StreamedMediaStream() override;
StreamedMediaChannelPtr channel() const;
@@ -156,7 +156,7 @@ public:
static StreamedMediaChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~StreamedMediaChannel();
+ ~StreamedMediaChannel() override;
bool awaitingLocalAnswer() const;
bool awaitingRemoteAnswer() const;
diff --git a/TelepathyQt/svc-call.xml b/TelepathyQt/svc-call.xml
new file mode 100644
index 00000000..7db11a62
--- /dev/null
+++ b/TelepathyQt/svc-call.xml
@@ -0,0 +1,12 @@
+<tp:spec
+ xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+<tp:title>Call interfaces</tp:title>
+
+<xi:include href="../spec/Call_Content.xml"/>
+<xi:include href="../spec/Call_Content_Interface_DTMF.xml"/>
+
+<xi:include href="../spec/Call_Interface_Mute.xml"/>
+
+</tp:spec>
diff --git a/TelepathyQt/svc-channel.xml b/TelepathyQt/svc-channel.xml
index 2df9cb06..e048321d 100644
--- a/TelepathyQt/svc-channel.xml
+++ b/TelepathyQt/svc-channel.xml
@@ -28,6 +28,7 @@
<xi:include href="../spec/Channel_Interface_Group.xml"/>
<xi:include href="../spec/Channel_Interface_Hold.xml"/>
<xi:include href="../spec/Channel_Interface_Media_Signalling.xml"/>
+<xi:include href="../spec/Channel_Interface_Mergeable_Conference.xml"/>
<xi:include href="../spec/Channel_Interface_Messages.xml"/>
<xi:include href="../spec/Channel_Interface_Password.xml"/>
<xi:include href="../spec/Channel_Interface_Room.xml"/>
@@ -36,6 +37,7 @@
<xi:include href="../spec/Channel_Interface_Securable.xml"/>
<xi:include href="../spec/Channel_Interface_Service_Point.xml"/>
<xi:include href="../spec/Channel_Interface_SMS.xml"/>
+<xi:include href="../spec/Channel_Interface_Splittable.xml"/>
<xi:include href="../spec/Channel_Interface_Subject.xml"/>
</tp:spec>
diff --git a/TelepathyQt/svc-debug.xml b/TelepathyQt/svc-debug.xml
new file mode 100644
index 00000000..c4312f9b
--- /dev/null
+++ b/TelepathyQt/svc-debug.xml
@@ -0,0 +1,9 @@
+<tp:spec
+ xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+<tp:title>Debug interfaces</tp:title>
+
+<xi:include href="../spec/Debug.xml"/>
+
+</tp:spec>
diff --git a/TelepathyQt/test-backdoors.cpp b/TelepathyQt/test-backdoors.cpp
index bf4b53a8..886ebb09 100644
--- a/TelepathyQt/test-backdoors.cpp
+++ b/TelepathyQt/test-backdoors.cpp
@@ -29,7 +29,7 @@ namespace Tp
void TestBackdoors::invalidateProxy(DBusProxy *proxy, const QString &reason, const QString &message)
{
- Q_ASSERT(proxy != 0);
+ Q_ASSERT(proxy != nullptr);
Q_ASSERT(proxy->isValid());
proxy->invalidate(reason, message);
diff --git a/TelepathyQt/text-channel.cpp b/TelepathyQt/text-channel.cpp
index a043e4c0..e4c2b068 100644
--- a/TelepathyQt/text-channel.cpp
+++ b/TelepathyQt/text-channel.cpp
@@ -123,8 +123,8 @@ TextChannel::Private::Private(TextChannel *parent)
readinessHelper(parent->readinessHelper()),
getAllInFlight(false),
gotProperties(false),
- messagePartSupport(0),
- deliveryReportingSupport(0),
+ messagePartSupport(nullptr),
+ deliveryReportingSupport(nullptr),
initialMessagesReceived(false)
{
ReadinessHelper::Introspectables introspectables;
@@ -999,7 +999,7 @@ PendingSendMessage *TextChannel::send(const QString &text,
*
* This method requires TextChannel::FeatureCore to be ready.
*
- * \param part The message parts.
+ * \param parts The message parts.
* \param flags Flags affecting how the message is sent.
* Note that the channel may ignore some or all flags, depending on
* deliveryReportingSupport(); the flags that were handled by the CM are provided in
@@ -1126,7 +1126,7 @@ void TextChannel::onPendingMessagesRemoved(const UIntList &ids)
void TextChannel::onTextSent(uint timestamp, uint type, const QString &text)
{
- emit messageSent(Message(timestamp, type, text), 0,
+ emit messageSent(Message(timestamp, type, text), nullptr,
QLatin1String(""));
}
@@ -1140,7 +1140,11 @@ void TextChannel::onTextReceived(uint id, uint timestamp, uint sender,
MessagePart header;
if (timestamp == 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
timestamp = QDateTime::currentDateTime().toTime_t();
+#else
+ timestamp = QDateTime::currentDateTime().toSecsSinceEpoch();
+#endif
}
header.insert(QLatin1String("message-received"),
QDBusVariant(static_cast<qlonglong>(timestamp)));
@@ -1192,7 +1196,11 @@ void TextChannel::onTextSendError(uint error, uint timestamp, uint type,
header.insert(QLatin1String("message-received"),
QDBusVariant(static_cast<qlonglong>(
+#if QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t())));
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch())));
+#endif
header.insert(QLatin1String("message-type"),
QDBusVariant(static_cast<uint>(
ChannelTextMessageTypeDeliveryReport)));
diff --git a/TelepathyQt/text-channel.h b/TelepathyQt/text-channel.h
index 075a0509..32c99918 100644
--- a/TelepathyQt/text-channel.h
+++ b/TelepathyQt/text-channel.h
@@ -52,7 +52,7 @@ public:
static TextChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~TextChannel();
+ ~TextChannel() override;
bool hasMessagesInterface() const;
bool hasChatStateInterface() const;
@@ -78,10 +78,10 @@ public Q_SLOTS:
PendingSendMessage *send(const QString &text,
ChannelTextMessageType type = ChannelTextMessageTypeNormal,
- MessageSendingFlags flags = 0);
+ MessageSendingFlags flags = nullptr);
PendingSendMessage *send(const MessagePartList &parts,
- MessageSendingFlags flags = 0);
+ MessageSendingFlags flags = nullptr);
inline PendingOperation *inviteContacts(
const QList<ContactPtr> &contacts,
diff --git a/TelepathyQt/tube-channel.h b/TelepathyQt/tube-channel.h
index c69224e0..5f3e0d1f 100644
--- a/TelepathyQt/tube-channel.h
+++ b/TelepathyQt/tube-channel.h
@@ -42,7 +42,7 @@ public:
static TubeChannelPtr create(const ConnectionPtr &connection,
const QString &objectPath, const QVariantMap &immutableProperties);
- virtual ~TubeChannel();
+ ~TubeChannel() override;
TubeChannelState state() const;
diff --git a/TelepathyQt/utils.cpp b/TelepathyQt/utils.cpp
index e4614c20..4611cf0f 100644
--- a/TelepathyQt/utils.cpp
+++ b/TelepathyQt/utils.cpp
@@ -27,10 +27,6 @@
#include <QByteArray>
#include <QStringList>
-/**
- * \defgroup utility functions
- */
-
namespace Tp
{
@@ -42,6 +38,8 @@ static inline bool isBad(char c, bool isFirst)
}
/**
+ * \ingroup utils
+ *
* Escape an arbitrary string so it follows the rules for a C identifier,
* and hence an object path component, interface element component,
* bus name component or member name in D-Bus.
@@ -119,6 +117,9 @@ QString escapeAsIdentifier(const QString &string)
return QString::fromLatin1(op.constData());
}
+/**
+ * \ingroup utils
+ */
bool checkValidProtocolName(const QString &protocolName)
{
if (protocolName.isEmpty()) {
@@ -145,6 +146,9 @@ bool checkValidProtocolName(const QString &protocolName)
return true;
}
+/**
+ * \ingroup utils
+ */
QVariant::Type variantTypeFromDBusSignature(const QString &signature)
{
QVariant::Type type;
@@ -171,6 +175,9 @@ QVariant::Type variantTypeFromDBusSignature(const QString &signature)
return type;
}
+/**
+ * \ingroup utils
+ */
QVariant parseValueWithDBusSignature(const QString &value,
const QString &dbusSignature)
{