Home · All Classes · All Namespaces · Modules · Functions · Files
captcha-authentication.h
00001 
00023 #ifndef _TelepathyQt_captcha_authentication_h_HEADER_GUARD_
00024 #define _TelepathyQt_captcha_authentication_h_HEADER_GUARD_
00025 
00026 #ifndef IN_TP_QT_HEADER
00027 #error IN_TP_QT_HEADER
00028 #endif
00029 
00030 #include <TelepathyQt/Channel>
00031 #include <TelepathyQt/Connection>
00032 
00033 #include <TelepathyQt/Global>
00034 #include <TelepathyQt/SharedPtr>
00035 
00036 namespace Tp
00037 {
00038 
00039 class PendingCaptchaAnswer;
00040 class PendingCaptchaCancel;
00041 class PendingCaptchas;
00042 
00043 class TP_QT_EXPORT CaptchaAuthentication : public Tp::Object
00044 {
00045     Q_OBJECT
00046     Q_DISABLE_COPY(CaptchaAuthentication)
00047 
00048 public:
00049     enum ChallengeType {
00050         NoChallenge = 0,
00051         OCRChallenge = 1,
00052         AudioRecognitionChallenge = 2,
00053         PictureQuestionChallenge = 4,
00054         PictureRecognitionChallenge = 8,
00055         TextQuestionChallenge = 16,
00056         SpeechQuestionChallenge = 32,
00057         SpeechRecognitionChallenge = 64,
00058         VideoQuestionChallenge = 128,
00059         VideoRecognitionChallenge = 256,
00060         UnknownChallenge = 32768
00061     };
00062     Q_DECLARE_FLAGS(ChallengeTypes, ChallengeType)
00063 
00064     virtual ~CaptchaAuthentication();
00065 
00066     ChannelPtr channel() const;
00067 
00068     bool canRetry() const;
00069     Tp::CaptchaStatus status() const;
00070 
00071     QString error() const;
00072     Connection::ErrorDetails errorDetails() const;
00073 
00074     Tp::PendingCaptchas *requestCaptchas(const QStringList &preferredMimeTypes = QStringList(),
00075             ChallengeTypes preferredTypes = ~ChallengeTypes(NoChallenge));
00076     Tp::PendingOperation *answer(uint id, const QString &answer);
00077     Tp::PendingOperation *answer(const Tp::CaptchaAnswers &response);
00078 
00079 Q_SIGNALS:
00080     void statusChanged(Tp::CaptchaStatus status);
00081 
00082 public Q_SLOTS:
00083     Tp::PendingOperation *cancel(Tp::CaptchaCancelReason reason,
00084             const QString &message = QString());
00085 
00086 private Q_SLOTS:
00087     TP_QT_NO_EXPORT void onPropertiesChanged(const QVariantMap &changedProperties,
00088             const QStringList &invalidatedProperties);
00089 
00090 private:
00091     TP_QT_NO_EXPORT CaptchaAuthentication(const ChannelPtr &parent);
00092 
00093     friend class ServerAuthenticationChannel;
00094 
00095     struct Private;
00096     friend struct Private;
00097     Private *mPriv;
00098 };
00099 
00100 } // namespace Tp
00101 
00102 Q_DECLARE_OPERATORS_FOR_FLAGS(Tp::CaptchaAuthentication::ChallengeTypes)
00103 
00104 #endif


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt 0.9.3