Home · All Classes · All Namespaces · Modules · Functions · Files
channel.h
00001 
00023 #ifndef _TelepathyQt4_channel_h_HEADER_GUARD_
00024 #define _TelepathyQt4_channel_h_HEADER_GUARD_
00025 
00026 #ifndef IN_TELEPATHY_QT4_HEADER
00027 #error IN_TELEPATHY_QT4_HEADER
00028 #endif
00029 
00030 #include <TelepathyQt4/_gen/cli-channel.h>
00031 
00032 #include <TelepathyQt4/Constants>
00033 #include <TelepathyQt4/DBus>
00034 #include <TelepathyQt4/DBusProxy>
00035 #include <TelepathyQt4/OptionalInterfaceFactory>
00036 #include <TelepathyQt4/ReadinessHelper>
00037 #include <TelepathyQt4/SharedPtr>
00038 #include <TelepathyQt4/Types>
00039 
00040 #include <QSet>
00041 #include <QSharedDataPointer>
00042 #include <QVariantMap>
00043 
00044 namespace Tp
00045 {
00046 
00047 class Connection;
00048 class PendingOperation;
00049 class PendingReady;
00050 
00051 class TELEPATHY_QT4_EXPORT Channel : public StatefulDBusProxy,
00052                 public OptionalInterfaceFactory<Channel>
00053 {
00054     Q_OBJECT
00055     Q_DISABLE_COPY(Channel)
00056 
00057 public:
00058     static const Feature FeatureCore;
00059     static const Feature FeatureConferenceInitialInviteeContacts;
00060 
00061     static ChannelPtr create(const ConnectionPtr &connection,
00062             const QString &objectPath, const QVariantMap &immutableProperties);
00063 
00064     virtual ~Channel();
00065 
00066     ConnectionPtr connection() const;
00067 
00068     QVariantMap immutableProperties() const;
00069 
00070     QString channelType() const;
00071 
00072     HandleType targetHandleType() const;
00073     uint targetHandle() const;
00074     QString targetId() const;
00075     ContactPtr targetContact() const;
00076 
00077     bool isRequested() const;
00078     ContactPtr initiatorContact() const;
00079 
00080     PendingOperation *requestClose();
00081     PendingOperation *requestLeave(const QString &message = QString(),
00082             ChannelGroupChangeReason reason = ChannelGroupChangeReasonNone);
00083 
00084     ChannelGroupFlags groupFlags() const;
00085 
00086     bool groupCanAddContacts() const;
00087     bool groupCanAddContactsWithMessage() const;
00088     bool groupCanAcceptContactsWithMessage() const;
00089     PendingOperation *groupAddContacts(const QList<ContactPtr> &contacts,
00090             const QString &message = QString());
00091     bool groupCanRescindContacts() const;
00092     bool groupCanRescindContactsWithMessage() const;
00093     bool groupCanRemoveContacts() const;
00094     bool groupCanRemoveContactsWithMessage() const;
00095     bool groupCanRejectContactsWithMessage() const;
00096     bool groupCanDepartWithMessage() const;
00097     PendingOperation *groupRemoveContacts(const QList<ContactPtr> &contacts,
00098             const QString &message = QString(),
00099             ChannelGroupChangeReason reason = ChannelGroupChangeReasonNone);
00100 
00105     Contacts groupContacts() const;
00106     Contacts groupLocalPendingContacts() const;
00107     Contacts groupRemotePendingContacts() const;
00108 
00109     class GroupMemberChangeDetails
00110     {
00111     public:
00112         GroupMemberChangeDetails();
00113         GroupMemberChangeDetails(const GroupMemberChangeDetails &other);
00114         ~GroupMemberChangeDetails();
00115 
00116         GroupMemberChangeDetails &operator=(const GroupMemberChangeDetails &other);
00117 
00118         bool isValid() const { return mPriv.constData() != 0; }
00119 
00120         bool hasActor() const;
00121         ContactPtr actor() const;
00122 
00123         bool hasReason() const { return allDetails().contains(QLatin1String("change-reason")); }
00124         ChannelGroupChangeReason reason() const { return (ChannelGroupChangeReason) qdbus_cast<uint>(allDetails().value(QLatin1String("change-reason"))); }
00125 
00126         bool hasMessage() const { return allDetails().contains(QLatin1String("message")); }
00127         QString message () const { return qdbus_cast<QString>(allDetails().value(QLatin1String("message"))); }
00128 
00129         bool hasError() const { return allDetails().contains(QLatin1String("error")); }
00130         QString error() const { return qdbus_cast<QString>(allDetails().value(QLatin1String("error"))); }
00131 
00132         bool hasDebugMessage() const { return allDetails().contains(QLatin1String("debug-message")); }
00133         QString debugMessage() const { return qdbus_cast<QString>(allDetails().value(QLatin1String("debug-message"))); }
00134 
00135         QVariantMap allDetails() const;
00136 
00137     private:
00138         friend class Channel;
00139         friend class Contact;
00140         friend class ContactManager;
00141 
00142         TELEPATHY_QT4_NO_EXPORT GroupMemberChangeDetails(const ContactPtr &actor, const QVariantMap &details);
00143 
00144         struct Private;
00145         friend struct Private;
00146         QSharedDataPointer<Private> mPriv;
00147     };
00148 
00149     GroupMemberChangeDetails groupLocalPendingContactChangeInfo(const ContactPtr &contact) const;
00150     GroupMemberChangeDetails groupSelfContactRemoveInfo() const;
00151 
00152     bool groupAreHandleOwnersAvailable() const;
00153     HandleOwnerMap groupHandleOwners() const;
00154 
00155     bool groupIsSelfContactTracked() const;
00156     ContactPtr groupSelfContact() const;
00157 
00158     bool isConference() const;
00159     Contacts conferenceInitialInviteeContacts() const;
00160     QList<ChannelPtr> conferenceChannels() const;
00161     QList<ChannelPtr> conferenceInitialChannels() const;
00162     QHash<uint, ChannelPtr> conferenceOriginalChannels() const;
00163 
00164     bool supportsConferenceMerging() const;
00165     PendingOperation *conferenceMergeChannel(const ChannelPtr &channel);
00166 
00167     bool supportsConferenceSplitting() const;
00168     PendingOperation *conferenceSplitChannel();
00169 
00170 Q_SIGNALS:
00171     void groupFlagsChanged(Tp::ChannelGroupFlags flags,
00172             Tp::ChannelGroupFlags added, Tp::ChannelGroupFlags removed);
00173 
00174     void groupCanAddContactsChanged(bool canAddContacts);
00175     void groupCanRemoveContactsChanged(bool canRemoveContacts);
00176     void groupCanRescindContactsChanged(bool canRescindContacts);
00177 
00178     void groupMembersChanged(
00179             const Tp::Contacts &groupMembersAdded,
00180             const Tp::Contacts &groupLocalPendingMembersAdded,
00181             const Tp::Contacts &groupRemotePendingMembersAdded,
00182             const Tp::Contacts &groupMembersRemoved,
00183             const Tp::Channel::GroupMemberChangeDetails &details);
00184 
00185     void groupHandleOwnersChanged(const Tp::HandleOwnerMap &owners,
00186             const Tp::UIntList &added, const Tp::UIntList &removed);
00187 
00188     void groupSelfContactChanged();
00189 
00190     void conferenceChannelMerged(const Tp::ChannelPtr &channel);
00191     void conferenceChannelRemoved(const Tp::ChannelPtr &channel,
00192             const Tp::Channel::GroupMemberChangeDetails &details);
00193 
00194 protected:
00195     Channel(const ConnectionPtr &connection,const QString &objectPath,
00196             const QVariantMap &immutableProperties, const Feature &coreFeature);
00197 
00198     Client::ChannelInterface *baseInterface() const;
00199 
00200     bool groupSelfHandleIsLocalPending() const;
00201 
00202 protected Q_SLOTS:
00203     PendingOperation *groupAddSelfHandle();
00204 
00205 private Q_SLOTS:
00206     TELEPATHY_QT4_NO_EXPORT void gotMainProperties(QDBusPendingCallWatcher *watcher);
00207     TELEPATHY_QT4_NO_EXPORT void gotChannelType(QDBusPendingCallWatcher *watcher);
00208     TELEPATHY_QT4_NO_EXPORT void gotHandle(QDBusPendingCallWatcher *watcher);
00209     TELEPATHY_QT4_NO_EXPORT void gotInterfaces(QDBusPendingCallWatcher *watcher);
00210     TELEPATHY_QT4_NO_EXPORT void onClosed();
00211 
00212     TELEPATHY_QT4_NO_EXPORT void onConnectionReady(Tp::PendingOperation *op);
00213     TELEPATHY_QT4_NO_EXPORT void onConnectionInvalidated();
00214 
00215     TELEPATHY_QT4_NO_EXPORT void gotGroupProperties(QDBusPendingCallWatcher *watcher);
00216     TELEPATHY_QT4_NO_EXPORT void gotGroupFlags(QDBusPendingCallWatcher *watcher);
00217     TELEPATHY_QT4_NO_EXPORT void gotAllMembers(QDBusPendingCallWatcher *watcher);
00218     TELEPATHY_QT4_NO_EXPORT void gotLocalPendingMembersWithInfo(QDBusPendingCallWatcher *watcher);
00219     TELEPATHY_QT4_NO_EXPORT void gotSelfHandle(QDBusPendingCallWatcher *watcher);
00220     TELEPATHY_QT4_NO_EXPORT void gotContacts(Tp::PendingOperation *op);
00221 
00222     TELEPATHY_QT4_NO_EXPORT void onGroupFlagsChanged(uint added, uint removed);
00223     TELEPATHY_QT4_NO_EXPORT void onMembersChanged(const QString &message,
00224             const Tp::UIntList &added, const Tp::UIntList &removed,
00225             const Tp::UIntList &localPending, const Tp::UIntList &remotePending,
00226             uint actor, uint reason);
00227     TELEPATHY_QT4_NO_EXPORT void onMembersChangedDetailed(
00228             const Tp::UIntList &added, const Tp::UIntList &removed,
00229             const Tp::UIntList &localPending, const Tp::UIntList &remotePending,
00230             const QVariantMap &details);
00231     TELEPATHY_QT4_NO_EXPORT void onHandleOwnersChanged(const Tp::HandleOwnerMap &added, const Tp::UIntList &removed);
00232     TELEPATHY_QT4_NO_EXPORT void onSelfHandleChanged(uint selfHandle);
00233 
00234     TELEPATHY_QT4_NO_EXPORT void gotConferenceProperties(QDBusPendingCallWatcher *watcher);
00235     TELEPATHY_QT4_NO_EXPORT void gotConferenceInitialInviteeContacts(Tp::PendingOperation *op);
00236     TELEPATHY_QT4_NO_EXPORT void onConferenceChannelMerged(const QDBusObjectPath &channel, uint channelSpecificHandle,
00237             const QVariantMap &properties);
00238     TELEPATHY_QT4_NO_EXPORT void onConferenceChannelMerged(const QDBusObjectPath &channel);
00239     TELEPATHY_QT4_NO_EXPORT void onConferenceChannelRemoved(const QDBusObjectPath &channel, const QVariantMap &details);
00240     TELEPATHY_QT4_NO_EXPORT void onConferenceChannelRemoved(const QDBusObjectPath &channel);
00241     TELEPATHY_QT4_NO_EXPORT void gotConferenceChannelRemovedActorContact(Tp::PendingOperation *op);
00242 
00243 private:
00244     class PendingLeave;
00245     friend class PendingLeave;
00246 
00247     struct Private;
00248     friend struct Private;
00249     Private *mPriv;
00250 };
00251 
00252 } // Tp
00253 
00254 Q_DECLARE_METATYPE(Tp::Channel::GroupMemberChangeDetails);
00255 
00256 #endif


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.6.5