Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor Class Reference

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

Public Slots | Public Member Functions | List of all members
Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor Class Reference
Channel service implementation

`#include <TelepathyQt/_gen/svc-channel.h>`

Inherits Tp::AbstractAdaptor.

## Public Slots
Tp::CaptchaInfoList | GetCaptchas (const QDBusMessage &dbusMessage, uint &numberRequired, QString &language)
QByteArray | GetCaptchaData (uint ID, const QString &mimeType, const QDBusMessage &dbusMessage)
void | AnswerCaptchas (const Tp::CaptchaAnswers &answers, const QDBusMessage &dbusMessage)
void | CancelCaptcha (uint reason, const QString &debugMessage, const QDBusMessage &dbusMessage)

## Public Member Functions
bool | CanRetryCaptcha () const
uint | CaptchaStatus () const
QString | CaptchaError () const
QVariantMap | CaptchaErrorDetails () const
Public Member Functions inherited from Tp::AbstractAdaptor
| AbstractAdaptor (const QDBusConnection &connection, QObject *adaptee, QObject *parent)
| ~AbstractAdaptor ()
QDBusConnection | dbusConnection () const
QObject * | adaptee () const

## Detailed Description

Adaptor class providing a 1:1 mapping of the D-Bus interface "org.freedesktop.Telepathy.Channel.Interface.CaptchaAuthentication1".

## Member Function Documentation

bool Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::CanRetryCaptcha | ( |  | ) | const

Return the value of the exported D-Bus object property `CanRetryCaptcha` of type `bool`.

Adaptees should export this property as a Qt property named 'canRetryCaptcha' with type bool.

If true, GetCaptchas() can be expected to return new captcha information when in the Local_Pending state. If false, GetCaptchas() will return NotAvailable on subsequent calls.

Refreshing the captcha isn't required to work, although some protocols and implementations allow it. This is usually done in case a given captcha is unintelligible.

Returns
  The value of exported property `CanRetryCaptcha`.

uint Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::CaptchaStatus | ( |  | ) | const

Return the value of the exported D-Bus object property `CaptchaStatus` of type `uint`.

Adaptees should export this property as a Qt property named 'captchaStatus' with type uint.

The current status of this channel.

Because only the Handler should call methods on this interface, the Handler MAY reduce round-trips by not fetching the initial value of this property, and instead assume that is initially Local_Pending.

This assumption normally avoids the need to call GetAll(), since the values of CaptchaError and CaptchaErrorDetails are also implied by this assumption, and the only other property is CanRetryCaptcha , which is immutable.

Returns
  The value of exported property `CaptchaStatus`.

QString Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::CaptchaError | ( |  | ) | const

Return the value of the exported D-Bus object property `CaptchaError` of type `QString`.

Adaptees should export this property as a Qt property named 'captchaError' with type QString.

The reason for the CaptchaStatus , or an empty string if the state is neither Try_Again nor Failed.

Typical values: "", Cancelled, AuthenticationFailed, CaptchaNotSupported

In particular, an ordinary authentication failure (as would be produced for an incorrect answer) SHOULD be represented by AuthenticationFailed, cancellation by the user's request SHOULD be represented by Cancelled, cancellation due to the inability to display the captcha to the user or otherwise answer it SHOULD be represented by CaptchaNotSupported, and cancellation by a local process due to inconsistent or invalid challenges from the server SHOULD be represented by ServiceConfused.

If this interface appears on a ChannelTypeServerAuthenticationInterface channel, and connection to the server fails with an authentication failure, this error code SHOULD be copied into the ConnectionInterface::ConnectionError() signal.

Returns
  The value of exported property `CaptchaError`.

QVariantMap Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::CaptchaErrorDetails | ( |  | ) | const

Return the value of the exported D-Bus object property `CaptchaErrorDetails` of type `QVariantMap`.

Adaptees should export this property as a Qt property named 'captchaErrorDetails' with type QVariantMap.

If CaptchaError is non-empty, any additional information about the last disconnection; otherwise, the empty map. The keys and values are the same as for the second argument of ConnectionInterface::ConnectionError() .

If this interface appears on a ChannelTypeServerAuthenticationInterface channel, and connection to the server fails with an authentication failure, these details SHOULD be copied into the ConnectionInterface::ConnectionError() signal.

Returns
  The value of exported property `CaptchaErrorDetails`.

Tp::CaptchaInfoList Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::GetCaptchas | ( | const QDBusMessage & | dbusMessage,
|  | uint & | numberRequired,
|  | QString & | language
| ) |  |
| slot

Begins a call to the exported D-Bus method `GetCaptchas` on this object.

Adaptees should export this method as a Qt slot with the following signature: void getCaptchas(const Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::GetCaptchasContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

Gets information regarding each of the captcha methods available and which and how many need to be successfully answered

To call this method successfully, the state must be Local_Pending or Try_Again. If it is Local_Pending, it remains Local_Pending. If called more than once while in Local_Pending state, or if the state is Try_Again, this method fetches a new set of captcha challenges, if possible, and the state returns to Local_Pending.

For instance, you could call GetCaptchas again from Local_Pending state if the user indicates that they can't understand the initially-offered captcha.

This is a method, not a property, so that it can be used to fetch more than one set of captcha challenges, and so that change notification is not required. Only the Handler should call this method and calling GetAll would not reduce round-trips, so the usual reasons to prefer a property do not apply here.

Parameters

  numberRequired | Output parameter

The number of captcha methods required to be answered in order to successfully complete this captcha challenge (most frequently 1, but XMPP allows servers to demand that more than one captcha is answered).

Parameters

  language | Output parameter

The language of each Label in Captcha_Info if available, for instance en_US, or "" if unknown.

Returns

Information about each of the available captcha methods.

QByteArray Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::GetCaptchaData | ( | uint | ID,
|  | const QString & | mimeType,
|  | const QDBusMessage & | dbusMessage
| ) |  |
| slot

Begins a call to the exported D-Bus method `GetCaptchaData` on this object.

Adaptees should export this method as a Qt slot with the following signature: void getCaptchaData(uint ID, const QString& mimeType, const Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::GetCaptchaDataContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

Fetch and return the captcha data. In protocols where captchas are downloaded out-of-band (for instance via HTTP), the connection manager is expected to do so.

Returns an empty array if the type was "qa"

If audio-based and image-based captchas are both available, we don't want to waste time downloading the audio until/unless the user asks to hear it. The extra D-Bus round-trips are not a problem, since they are expected to be quick compared with the time taken for the user to solve the captcha.

Parameters

  ID |
      The ID of the captcha of which to retrieve data.
  mimeType |
      MIME type picked by the Handler, chosen from the list of MIME types
      received in GetCaptchas. XEP-0158 allows the same captcha to be
      made available in multiple formats, for instance the same spoken
      question as audio/x-wav, application/ogg and audio/speex.

Returns

      Captcha data as requested.

void Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::AnswerCaptchas | ( | const Tp::CaptchaAnswers & | answers,
|  | const QDBusMessage & | dbusMessage
| ) |  |
| slot

Begins a call to the exported D-Bus method `AnswerCaptchas` on this object.

Adaptees should export this method as a Qt slot with the following signature: void answerCaptchas(const Tp::CaptchaAnswers& answers, const Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::AnswerCaptchasContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

Answer as many captchas as desired and/or required.

Callable in state Local_Pending only. State changes to Remote_Pending.

Parameters

  answers |
      The mapping of captcha IDs to answer strings.

void Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::CancelCaptcha | ( | uint | reason,
|  | const QString & | debugMessage,
|  | const QDBusMessage & | dbusMessage
| ) |  |
| slot

Begins a call to the exported D-Bus method `CancelCaptcha` on this object.

Adaptees should export this method as a Qt slot with the following signature: void cancelCaptcha(uint reason, const QString& debugMessage, const Tp::Service::ChannelInterfaceCaptchaAuthenticationAdaptor::CancelCaptchaContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

Cancel. State changes to Failed with error NotAvailable or Cancelled if it isn't already Failed. All you can do now is to close the channel.

Parameters

  reason |
      Reason for cancelling. This MAY be used to choose an error response
      to the remote server, and SHOULD also be reflected in the
      CaptchaError.
  debugMessage |
      A textual description of the reason for cancelling, supplied by the
      Handler. This message SHOULD NOT be sent to the remote server, but
      SHOULD be copied into the &apos;debug-message&apos; field of the
      CaptchaErrorDetails and ConnectionError.