~ubuntu-branches/ubuntu/wily/telepathy-qt5/wily

« back to all changes in this revision

Viewing changes to TelepathyQt/base-channel.h

  • Committer: Package Import Robot
  • Author(s): Tiago Salem Herrmann
  • Date: 2015-05-29 18:01:17 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20150529180117-nj5geaevciyps6b5
Tags: 0.9.6.1-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * This file is part of TelepathyQt
3
3
 *
4
4
 * @copyright Copyright (C) 2013 Matthias Gehre <gehre.matthias@gmail.com>
5
 
 * @copyright Copyright 2013 Canonical Ltd.
6
5
 * @license LGPL 2.1
7
6
 *
8
7
 * This library is free software; you can redistribute it and/or
46
45
    Q_DISABLE_COPY(BaseChannel)
47
46
 
48
47
public:
49
 
    static BaseChannelPtr create(BaseConnection* connection, const QString &channelType,
50
 
                                 uint targetHandle, uint targetHandleType) {
 
48
    static BaseChannelPtr create(BaseConnection *connection, const QString &channelType,
 
49
                                 Tp::HandleType targetHandleType = Tp::HandleTypeNone, uint targetHandle = 0) {
51
50
        return BaseChannelPtr(new BaseChannel(QDBusConnection::sessionBus(), connection,
52
 
                                              channelType, targetHandle, targetHandleType));
 
51
                                              channelType, targetHandleType, targetHandle));
53
52
    }
54
53
 
55
54
    virtual ~BaseChannel();
74
73
    void setTargetID(const QString &targetID);
75
74
    void setRequested(bool requested);
76
75
 
 
76
    void close();
 
77
 
77
78
    bool plugInterface(const AbstractChannelInterfacePtr &interface);
78
 
    BaseConnection * baseConnection() const;
79
 
    void close();
80
79
 
81
80
Q_SIGNALS:
82
81
    void closed();
83
82
protected:
84
 
    BaseChannel(const QDBusConnection &dbusConnection, BaseConnection* connection,
85
 
                const QString &channelType, uint targetHandle, uint targetHandleType);
 
83
    BaseChannel(const QDBusConnection &dbusConnection, BaseConnection *connection,
 
84
                const QString &channelType, uint targetHandleType, uint targetHandle);
86
85
    virtual bool registerObject(const QString &busName, const QString &objectPath,
87
86
                                DBusError *error);
88
87
private:
89
88
    class Adaptee;
90
89
    friend class Adaptee;
91
 
    class Private;
92
 
    friend class Private;
 
90
    struct Private;
 
91
    friend struct Private;
93
92
    Private *mPriv;
94
93
};
95
94
 
105
104
private:
106
105
    friend class BaseChannel;
107
106
 
108
 
    class Private;
109
 
    friend class Private;
 
107
    struct Private;
 
108
    friend struct Private;
110
109
    Private *mPriv;
 
110
 
111
111
};
112
112
 
113
113
class TP_QT_EXPORT BaseChannelTextType : public AbstractChannelInterface
216
216
    Private *mPriv;
217
217
};
218
218
 
 
219
class TP_QT_EXPORT BaseChannelRoomListType : public AbstractChannelInterface
 
220
{
 
221
    Q_OBJECT
 
222
    Q_DISABLE_COPY(BaseChannelRoomListType)
 
223
 
 
224
public:
 
225
    static BaseChannelRoomListTypePtr create(const QString &server = QString())
 
226
    {
 
227
        return BaseChannelRoomListTypePtr(new BaseChannelRoomListType(server));
 
228
    }
 
229
    template<typename BaseChannelRoomListTypeSubclass>
 
230
    static SharedPtr<BaseChannelRoomListTypeSubclass> create(const QString &server = QString())
 
231
    {
 
232
        return SharedPtr<BaseChannelRoomListTypeSubclass>(
 
233
                new BaseChannelRoomListTypeSubclass(server));
 
234
    }
 
235
 
 
236
    virtual ~BaseChannelRoomListType();
 
237
 
 
238
    QVariantMap immutableProperties() const;
 
239
 
 
240
    QString server() const;
 
241
 
 
242
    bool getListingRooms();
 
243
    void setListingRooms(bool listing);
 
244
 
 
245
    typedef Callback1<void, DBusError*> ListRoomsCallback;
 
246
    void setListRoomsCallback(const ListRoomsCallback &cb);
 
247
    void listRooms(DBusError *error);
 
248
 
 
249
    typedef Callback1<void, DBusError*> StopListingCallback;
 
250
    void setStopListingCallback(const StopListingCallback &cb);
 
251
    void stopListing(DBusError *error);
 
252
 
 
253
    void gotRooms(const Tp::RoomInfoList &rooms);
 
254
 
 
255
protected:
 
256
    BaseChannelRoomListType(const QString &server);
 
257
 
 
258
private:
 
259
    void createAdaptor();
 
260
 
 
261
    class Adaptee;
 
262
    friend class Adaptee;
 
263
    struct Private;
 
264
    friend struct Private;
 
265
    Private *mPriv;
 
266
};
 
267
 
219
268
class TP_QT_EXPORT BaseChannelServerAuthenticationType : public AbstractChannelInterface
220
269
{
221
270
    Q_OBJECT
290
339
    Private *mPriv;
291
340
};
292
341
 
 
342
class TP_QT_EXPORT BaseChannelSASLAuthenticationInterface : public AbstractChannelInterface
 
343
{
 
344
    Q_OBJECT
 
345
    Q_DISABLE_COPY(BaseChannelSASLAuthenticationInterface)
 
346
 
 
347
public:
 
348
    static BaseChannelSASLAuthenticationInterfacePtr create(const QStringList &availableMechanisms,
 
349
                                                            bool hasInitialData,
 
350
                                                            bool canTryAgain,
 
351
                                                            const QString &authorizationIdentity,
 
352
                                                            const QString &defaultUsername,
 
353
                                                            const QString &defaultRealm,
 
354
                                                            bool maySaveResponse)
 
355
    {
 
356
        return BaseChannelSASLAuthenticationInterfacePtr(new BaseChannelSASLAuthenticationInterface(availableMechanisms,
 
357
                                                                                                    hasInitialData,
 
358
                                                                                                    canTryAgain,
 
359
                                                                                                    authorizationIdentity,
 
360
                                                                                                    defaultUsername,
 
361
                                                                                                    defaultRealm,
 
362
                                                                                                    maySaveResponse));
 
363
    }
 
364
    template<typename BaseChannelSASLAuthenticationInterfaceSubclass>
 
365
    static SharedPtr<BaseChannelSASLAuthenticationInterfaceSubclass> create(const QStringList &availableMechanisms,
 
366
                                                                            bool hasInitialData,
 
367
                                                                            bool canTryAgain,
 
368
                                                                            const QString &authorizationIdentity,
 
369
                                                                            const QString &defaultUsername,
 
370
                                                                            const QString &defaultRealm,
 
371
                                                                            bool maySaveResponse)
 
372
    {
 
373
        return SharedPtr<BaseChannelSASLAuthenticationInterfaceSubclass>(
 
374
                new BaseChannelSASLAuthenticationInterfaceSubclass(availableMechanisms,
 
375
                                                                   hasInitialData,
 
376
                                                                   canTryAgain,
 
377
                                                                   authorizationIdentity,
 
378
                                                                   defaultUsername,
 
379
                                                                   defaultRealm,
 
380
                                                                   maySaveResponse));
 
381
    }
 
382
 
 
383
    virtual ~BaseChannelSASLAuthenticationInterface();
 
384
 
 
385
    QVariantMap immutableProperties() const;
 
386
 
 
387
    QStringList availableMechanisms() const;
 
388
    bool hasInitialData() const;
 
389
    bool canTryAgain() const;
 
390
    QString authorizationIdentity() const;
 
391
    QString defaultUsername() const;
 
392
    QString defaultRealm() const;
 
393
    bool maySaveResponse() const;
 
394
 
 
395
    uint saslStatus() const;
 
396
    void setSaslStatus(uint status, const QString &reason, const QVariantMap &details);
 
397
 
 
398
    QString saslError() const;
 
399
    void setSaslError(const QString &saslError);
 
400
 
 
401
    QVariantMap saslErrorDetails() const;
 
402
    void setSaslErrorDetails(const QVariantMap &saslErrorDetails);
 
403
 
 
404
    typedef Callback2<void, const QString &, DBusError*> StartMechanismCallback;
 
405
    void setStartMechanismCallback(const StartMechanismCallback &cb);
 
406
    void startMechanism(const QString &mechanism, DBusError *error);
 
407
 
 
408
    typedef Callback3<void, const QString &, const QByteArray &, DBusError*> StartMechanismWithDataCallback;
 
409
    void setStartMechanismWithDataCallback(const StartMechanismWithDataCallback &cb);
 
410
    void startMechanismWithData(const QString &mechanism, const QByteArray &initialData, DBusError *error);
 
411
 
 
412
    typedef Callback2<void, const QByteArray &, DBusError*> RespondCallback;
 
413
    void setRespondCallback(const RespondCallback &cb);
 
414
    void respond(const QByteArray &responseData, DBusError *error);
 
415
 
 
416
    typedef Callback1<void, DBusError*> AcceptSASLCallback;
 
417
    void setAcceptSaslCallback(const AcceptSASLCallback &cb);
 
418
    void acceptSasl(DBusError *error);
 
419
 
 
420
    typedef Callback3<void, uint, const QString &, DBusError*> AbortSASLCallback;
 
421
    void setAbortSaslCallback(const AbortSASLCallback &cb);
 
422
    void abortSasl(uint reason, const QString &debugMessage, DBusError *error);
 
423
 
 
424
    void newChallenge(const QByteArray &challengeData);
 
425
 
 
426
protected:
 
427
    BaseChannelSASLAuthenticationInterface(const QStringList &availableMechanisms,
 
428
                                           bool hasInitialData,
 
429
                                           bool canTryAgain,
 
430
                                           const QString &authorizationIdentity,
 
431
                                           const QString &defaultUsername,
 
432
                                           const QString &defaultRealm,
 
433
                                           bool maySaveResponse);
 
434
 
 
435
private:
 
436
    void createAdaptor();
 
437
 
 
438
    class Adaptee;
 
439
    friend class Adaptee;
 
440
    struct Private;
 
441
    friend struct Private;
 
442
    Private *mPriv;
 
443
};
 
444
 
 
445
class TP_QT_EXPORT BaseChannelSecurableInterface : public AbstractChannelInterface
 
446
{
 
447
    Q_OBJECT
 
448
    Q_DISABLE_COPY(BaseChannelSecurableInterface)
 
449
 
 
450
public:
 
451
    static BaseChannelSecurableInterfacePtr create()
 
452
    {
 
453
        return BaseChannelSecurableInterfacePtr(new BaseChannelSecurableInterface());
 
454
    }
 
455
    template<typename BaseChannelSecurableInterfaceSubclass>
 
456
    static SharedPtr<BaseChannelSecurableInterfaceSubclass> create()
 
457
    {
 
458
        return SharedPtr<BaseChannelSecurableInterfaceSubclass>(
 
459
                new BaseChannelSecurableInterfaceSubclass());
 
460
    }
 
461
 
 
462
    virtual ~BaseChannelSecurableInterface();
 
463
 
 
464
    QVariantMap immutableProperties() const;
 
465
 
 
466
    bool encrypted() const;
 
467
    void setEncrypted(bool encrypted);
 
468
 
 
469
    bool verified() const;
 
470
    void setVerified(bool verified);
 
471
 
 
472
protected:
 
473
    BaseChannelSecurableInterface();
 
474
 
 
475
private:
 
476
    void createAdaptor();
 
477
 
 
478
    class Adaptee;
 
479
    friend class Adaptee;
 
480
    struct Private;
 
481
    friend struct Private;
 
482
    Private *mPriv;
 
483
};
 
484
 
 
485
class TP_QT_EXPORT BaseChannelChatStateInterface : public AbstractChannelInterface
 
486
{
 
487
    Q_OBJECT
 
488
    Q_DISABLE_COPY(BaseChannelChatStateInterface)
 
489
 
 
490
public:
 
491
    static BaseChannelChatStateInterfacePtr create()
 
492
    {
 
493
        return BaseChannelChatStateInterfacePtr(new BaseChannelChatStateInterface());
 
494
    }
 
495
    template<typename BaseChannelChatStateInterfaceSubclass>
 
496
    static SharedPtr<BaseChannelChatStateInterfaceSubclass> create()
 
497
    {
 
498
        return SharedPtr<BaseChannelChatStateInterfaceSubclass>(
 
499
                new BaseChannelChatStateInterfaceSubclass());
 
500
    }
 
501
 
 
502
    virtual ~BaseChannelChatStateInterface();
 
503
 
 
504
    QVariantMap immutableProperties() const;
 
505
 
 
506
    Tp::ChatStateMap chatStates() const;
 
507
    void setChatStates(const Tp::ChatStateMap &chatStates);
 
508
 
 
509
    typedef Callback2<void, uint, DBusError*> SetChatStateCallback;
 
510
    void setSetChatStateCallback(const SetChatStateCallback &cb);
 
511
    void setChatState(uint state, DBusError *error);
 
512
 
 
513
    void chatStateChanged(uint contact, uint state);
 
514
 
 
515
protected:
 
516
    BaseChannelChatStateInterface();
 
517
 
 
518
private:
 
519
    void createAdaptor();
 
520
 
 
521
    class Adaptee;
 
522
    friend class Adaptee;
 
523
    struct Private;
 
524
    friend struct Private;
 
525
    Private *mPriv;
 
526
};
 
527
 
293
528
class TP_QT_EXPORT BaseChannelGroupInterface : public AbstractChannelInterface
294
529
{
295
530
    Q_OBJECT
330
565
    Private *mPriv;
331
566
};
332
567
 
 
568
class TP_QT_EXPORT BaseChannelRoomInterface : public AbstractChannelInterface
 
569
{
 
570
    Q_OBJECT
 
571
    Q_DISABLE_COPY(BaseChannelRoomInterface)
 
572
 
 
573
public:
 
574
    static BaseChannelRoomInterfacePtr create(const QString &roomName,
 
575
                                              const QString &server,
 
576
                                              const QString &creator,
 
577
                                              uint creatorHandle,
 
578
                                              const QDateTime &creationTimestamp)
 
579
    {
 
580
        return BaseChannelRoomInterfacePtr(new BaseChannelRoomInterface(roomName,
 
581
                                                                        server,
 
582
                                                                        creator,
 
583
                                                                        creatorHandle,
 
584
                                                                        creationTimestamp));
 
585
    }
 
586
    template<typename BaseChannelRoomInterfaceSubclass>
 
587
    static SharedPtr<BaseChannelRoomInterfaceSubclass> create(const QString &roomName,
 
588
                                                              const QString &server,
 
589
                                                              const QString &creator,
 
590
                                                              uint creatorHandle,
 
591
                                                              const QDateTime &creationTimestamp)
 
592
    {
 
593
        return SharedPtr<BaseChannelRoomInterfaceSubclass>(
 
594
                new BaseChannelRoomInterfaceSubclass(roomName,
 
595
                                                     server,
 
596
                                                     creator,
 
597
                                                     creatorHandle,
 
598
                                                     creationTimestamp));
 
599
    }
 
600
 
 
601
    virtual ~BaseChannelRoomInterface();
 
602
 
 
603
    QVariantMap immutableProperties() const;
 
604
 
 
605
    QString roomName() const;
 
606
    QString server() const;
 
607
    QString creator() const;
 
608
    uint creatorHandle() const;
 
609
    QDateTime creationTimestamp() const;
 
610
 
 
611
protected:
 
612
    BaseChannelRoomInterface(const QString &roomName,
 
613
                             const QString &server,
 
614
                             const QString &creator,
 
615
                             uint creatorHandle,
 
616
                             const QDateTime &creationTimestamp);
 
617
 
 
618
private:
 
619
    void createAdaptor();
 
620
 
 
621
    class Adaptee;
 
622
    friend class Adaptee;
 
623
    struct Private;
 
624
    friend struct Private;
 
625
    Private *mPriv;
 
626
};
 
627
 
 
628
class TP_QT_EXPORT BaseChannelRoomConfigInterface : public AbstractChannelInterface
 
629
{
 
630
    Q_OBJECT
 
631
    Q_DISABLE_COPY(BaseChannelRoomConfigInterface)
 
632
 
 
633
public:
 
634
    static BaseChannelRoomConfigInterfacePtr create()
 
635
    {
 
636
        return BaseChannelRoomConfigInterfacePtr(new BaseChannelRoomConfigInterface());
 
637
    }
 
638
    template<typename BaseChannelRoomConfigInterfaceSubclass>
 
639
    static SharedPtr<BaseChannelRoomConfigInterfaceSubclass> create()
 
640
    {
 
641
        return SharedPtr<BaseChannelRoomConfigInterfaceSubclass>(
 
642
                new BaseChannelRoomConfigInterfaceSubclass());
 
643
    }
 
644
 
 
645
    virtual ~BaseChannelRoomConfigInterface();
 
646
 
 
647
    QVariantMap immutableProperties() const;
 
648
 
 
649
    bool anonymous() const;
 
650
    void setAnonymous(bool anonymous);
 
651
 
 
652
    bool inviteOnly() const;
 
653
    void setInviteOnly(bool inviteOnly);
 
654
 
 
655
    uint limit() const;
 
656
    void setLimit(uint limit);
 
657
 
 
658
    bool moderated() const;
 
659
    void setModerated(bool moderated);
 
660
 
 
661
    QString title() const;
 
662
    void setTitle(const QString &title);
 
663
 
 
664
    QString description() const;
 
665
    void setDescription(const QString &description);
 
666
 
 
667
    bool persistent() const;
 
668
    void setPersistent(bool persistent);
 
669
 
 
670
    bool isPrivate() const;
 
671
    void setPrivate(bool newPrivate);
 
672
 
 
673
    bool passwordProtected() const;
 
674
    void setPasswordProtected(bool passwordProtected);
 
675
 
 
676
    QString password() const;
 
677
    void setPassword(const QString &password);
 
678
 
 
679
    QString passwordHint() const;
 
680
    void setPasswordHint(const QString &passwordHint);
 
681
 
 
682
    bool canUpdateConfiguration() const;
 
683
    void setCanUpdateConfiguration(bool canUpdateConfiguration);
 
684
 
 
685
    QStringList mutableProperties() const;
 
686
    void setMutableProperties(const QStringList &mutableProperties);
 
687
 
 
688
    bool configurationRetrieved() const;
 
689
    void setConfigurationRetrieved(bool configurationRetrieved);
 
690
 
 
691
    typedef Callback2<void, const QVariantMap &, DBusError*> UpdateConfigurationCallback;
 
692
    void setUpdateConfigurationCallback(const UpdateConfigurationCallback &cb);
 
693
    void updateConfiguration(const QVariantMap &properties, DBusError *error);
 
694
 
 
695
protected:
 
696
    BaseChannelRoomConfigInterface();
 
697
 
 
698
private:
 
699
    void createAdaptor();
 
700
 
 
701
    class Adaptee;
 
702
    friend class Adaptee;
 
703
    struct Private;
 
704
    friend struct Private;
 
705
    Private *mPriv;
 
706
};
 
707
 
333
708
class TP_QT_EXPORT BaseChannelCallType : public AbstractChannelInterface
334
709
{
335
710
    Q_OBJECT
625
1000
    Private *mPriv;
626
1001
};
627
1002
 
628
 
 
629
1003
}
630
1004
#endif