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 
00075     bool isRequested() const;
00076     ContactPtr initiatorContact() const;
00077 
00078     PendingOperation *requestClose();
00079     PendingOperation *requestLeave(const QString &message = QString(),
00080             ChannelGroupChangeReason reason = ChannelGroupChangeReasonNone);
00081 
00082     ChannelGroupFlags groupFlags() const;
00083 
00084     bool groupCanAddContacts() const;
00085     bool groupCanAddContactsWithMessage() const;
00086     bool groupCanAcceptContactsWithMessage() const;
00087     PendingOperation *groupAddContacts(const QList<ContactPtr> &contacts,
00088             const QString &message = QString());
00089     bool groupCanRescindContacts() const;
00090     bool groupCanRescindContactsWithMessage() const;
00091     bool groupCanRemoveContacts() const;
00092     bool groupCanRemoveContactsWithMessage() const;
00093     bool groupCanRejectContactsWithMessage() const;
00094     bool groupCanDepartWithMessage() const;
00095     PendingOperation *groupRemoveContacts(const QList<ContactPtr> &contacts,
00096             const QString &message = QString(),
00097             ChannelGroupChangeReason reason = ChannelGroupChangeReasonNone);
00098 
00103     Contacts groupContacts() const;
00104     Contacts groupLocalPendingContacts() const;
00105     Contacts groupRemotePendingContacts() const;
00106 
00107     class GroupMemberChangeDetails
00108     {
00109     public:
00110         GroupMemberChangeDetails();
00111         GroupMemberChangeDetails(const GroupMemberChangeDetails &other);
00112         ~GroupMemberChangeDetails();
00113 
00114         GroupMemberChangeDetails &operator=(const GroupMemberChangeDetails &other);
00115 
00116         bool isValid() const { return mPriv.constData() != 0; }
00117 
00118         bool hasActor() const;
00119         ContactPtr actor() const;
00120 
00121         bool hasReason() const { return allDetails().contains(QLatin1String("change-reason")); }
00122         ChannelGroupChangeReason reason() const { return (ChannelGroupChangeReason) qdbus_cast<uint>(allDetails().value(QLatin1String("change-reason"))); }
00123 
00124         bool hasMessage() const { return allDetails().contains(QLatin1String("message")); }
00125         QString message () const { return qdbus_cast<QString>(allDetails().value(QLatin1String("message"))); }
00126 
00127         bool hasError() const { return allDetails().contains(QLatin1String("error")); }
00128         QString error() const { return qdbus_cast<QString>(allDetails().value(QLatin1String("error"))); }
00129 
00130         bool hasDebugMessage() const { return allDetails().contains(QLatin1String("debug-message")); }
00131         QString debugMessage() const { return qdbus_cast<QString>(allDetails().value(QLatin1String("debug-message"))); }
00132 
00133         QVariantMap allDetails() const;
00134 
00135     private:
00136         friend class Channel;
00137         friend class Contact;
00138         friend class ContactManager;
00139 
00140         TELEPATHY_QT4_NO_EXPORT GroupMemberChangeDetails(const ContactPtr &actor, const QVariantMap &details);
00141 
00142         struct Private;
00143         friend struct Private;
00144         QSharedDataPointer<Private> mPriv;
00145     };
00146 
00147     GroupMemberChangeDetails groupLocalPendingContactChangeInfo(const ContactPtr &contact) const;
00148     GroupMemberChangeDetails groupSelfContactRemoveInfo() const;
00149 
00150     bool groupAreHandleOwnersAvailable() const;
00151     HandleOwnerMap groupHandleOwners() const;
00152 
00153     bool groupIsSelfContactTracked() const;
00154     ContactPtr groupSelfContact() const;
00155 
00156     bool isConference() const;
00157     Contacts conferenceInitialInviteeContacts() const;
00158     QList<ChannelPtr> conferenceChannels() const;
00159     QList<ChannelPtr> conferenceInitialChannels() const;
00160     QHash<uint, ChannelPtr> conferenceOriginalChannels() const;
00161 
00162     bool supportsConferenceMerging() const;
00163     PendingOperation *conferenceMergeChannel(const ChannelPtr &channel);
00164 
00165     bool supportsConferenceSplitting() const;
00166     PendingOperation *conferenceSplitChannel();
00167 
00168 Q_SIGNALS:
00169     void groupFlagsChanged(Tp::ChannelGroupFlags flags,
00170             Tp::ChannelGroupFlags added, Tp::ChannelGroupFlags removed);
00171 
00172     void groupCanAddContactsChanged(bool canAddContacts);
00173     void groupCanRemoveContactsChanged(bool canRemoveContacts);
00174     void groupCanRescindContactsChanged(bool canRescindContacts);
00175 
00176     void groupMembersChanged(
00177             const Tp::Contacts &groupMembersAdded,
00178             const Tp::Contacts &groupLocalPendingMembersAdded,
00179             const Tp::Contacts &groupRemotePendingMembersAdded,
00180             const Tp::Contacts &groupMembersRemoved,
00181             const Tp::Channel::GroupMemberChangeDetails &details);
00182 
00183     void groupHandleOwnersChanged(const Tp::HandleOwnerMap &owners,
00184             const Tp::UIntList &added, const Tp::UIntList &removed);
00185 
00186     void groupSelfContactChanged();
00187 
00188     void conferenceChannelMerged(const Tp::ChannelPtr &channel);
00189     void conferenceChannelRemoved(const Tp::ChannelPtr &channel,
00190             const Tp::Channel::GroupMemberChangeDetails &details);
00191 
00192 protected:
00193     Channel(const ConnectionPtr &connection,const QString &objectPath,
00194             const QVariantMap &immutableProperties, const Feature &coreFeature);
00195 
00196     Client::ChannelInterface *baseInterface() const;
00197 
00198     bool groupSelfHandleIsLocalPending() const;
00199 
00200 protected Q_SLOTS:
00201     PendingOperation *groupAddSelfHandle();
00202 
00203 private Q_SLOTS:
00204     TELEPATHY_QT4_NO_EXPORT void gotMainProperties(QDBusPendingCallWatcher *watcher);
00205     TELEPATHY_QT4_NO_EXPORT void gotChannelType(QDBusPendingCallWatcher *watcher);
00206     TELEPATHY_QT4_NO_EXPORT void gotHandle(QDBusPendingCallWatcher *watcher);
00207     TELEPATHY_QT4_NO_EXPORT void gotInterfaces(QDBusPendingCallWatcher *watcher);
00208     TELEPATHY_QT4_NO_EXPORT void onClosed();
00209 
00210     TELEPATHY_QT4_NO_EXPORT void onConnectionReady(Tp::PendingOperation *op);
00211     TELEPATHY_QT4_NO_EXPORT void onConnectionInvalidated();
00212 
00213     TELEPATHY_QT4_NO_EXPORT void gotGroupProperties(QDBusPendingCallWatcher *watcher);
00214     TELEPATHY_QT4_NO_EXPORT void gotGroupFlags(QDBusPendingCallWatcher *watcher);
00215     TELEPATHY_QT4_NO_EXPORT void gotAllMembers(QDBusPendingCallWatcher *watcher);
00216     TELEPATHY_QT4_NO_EXPORT void gotLocalPendingMembersWithInfo(QDBusPendingCallWatcher *watcher);
00217     TELEPATHY_QT4_NO_EXPORT void gotSelfHandle(QDBusPendingCallWatcher *watcher);
00218     TELEPATHY_QT4_NO_EXPORT void gotContacts(Tp::PendingOperation *op);
00219 
00220     TELEPATHY_QT4_NO_EXPORT void onGroupFlagsChanged(uint added, uint removed);
00221     TELEPATHY_QT4_NO_EXPORT void onMembersChanged(const QString &message,
00222             const Tp::UIntList &added, const Tp::UIntList &removed,
00223             const Tp::UIntList &localPending, const Tp::UIntList &remotePending,
00224             uint actor, uint reason);
00225     TELEPATHY_QT4_NO_EXPORT void onMembersChangedDetailed(
00226             const Tp::UIntList &added, const Tp::UIntList &removed,
00227             const Tp::UIntList &localPending, const Tp::UIntList &remotePending,
00228             const QVariantMap &details);
00229     TELEPATHY_QT4_NO_EXPORT void onHandleOwnersChanged(const Tp::HandleOwnerMap &added, const Tp::UIntList &removed);
00230     TELEPATHY_QT4_NO_EXPORT void onSelfHandleChanged(uint selfHandle);
00231 
00232     TELEPATHY_QT4_NO_EXPORT void gotConferenceProperties(QDBusPendingCallWatcher *watcher);
00233     TELEPATHY_QT4_NO_EXPORT void gotConferenceInitialInviteeContacts(Tp::PendingOperation *op);
00234     TELEPATHY_QT4_NO_EXPORT void onConferenceChannelMerged(const QDBusObjectPath &channel, uint channelSpecificHandle,
00235             const QVariantMap &properties);
00236     TELEPATHY_QT4_NO_EXPORT void onConferenceChannelMerged(const QDBusObjectPath &channel);
00237     TELEPATHY_QT4_NO_EXPORT void onConferenceChannelRemoved(const QDBusObjectPath &channel, const QVariantMap &details);
00238     TELEPATHY_QT4_NO_EXPORT void onConferenceChannelRemoved(const QDBusObjectPath &channel);
00239     TELEPATHY_QT4_NO_EXPORT void gotConferenceChannelRemovedActorContact(Tp::PendingOperation *op);
00240 
00241 private:
00242     class PendingLeave;
00243     friend class PendingLeave;
00244 
00245     struct Private;
00246     friend struct Private;
00247     Private *mPriv;
00248 };
00249 
00250 } // Tp
00251 
00252 Q_DECLARE_METATYPE(Tp::Channel::GroupMemberChangeDetails);
00253 
00254 #endif


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