Home · All Classes · All Namespaces · Modules · Functions · Files
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Tp::BaseChannelGroupInterface Class Reference

Base class for implementations of Channel.Interface.Group. More...

#include <TelepathyQt/BaseChannel>

Inherits Tp::AbstractChannelInterface.

Public Types

typedef Callback3< void, const Tp::UIntList &, const QString &, DBusError * > AddMembersCallback
 
typedef Callback4< void, const Tp::UIntList &, const QString &, uint, DBusError * > RemoveMembersCallback
 

Public Member Functions

virtual ~BaseChannelGroupInterface ()
 
QVariantMap immutableProperties () const
 
Tp::ChannelGroupFlags groupFlags () const
 
void setGroupFlags (const Tp::ChannelGroupFlags &flags)
 
Tp::UIntList members () const
 
void setMembers (const Tp::UIntList &members, const QVariantMap &details)
 
void setMembers (const Tp::UIntList &members, const Tp::LocalPendingInfoList &localPending, const Tp::UIntList &remotePending, const QVariantMap &details)
 
Tp::HandleOwnerMap handleOwners () const
 
void setHandleOwners (const Tp::HandleOwnerMap &handleOwners)
 
Tp::LocalPendingInfoList localPendingMembers () const
 
void setLocalPendingMembers (const Tp::LocalPendingInfoList &localPendingMembers)
 
Tp::UIntList remotePendingMembers () const
 
void setRemotePendingMembers (const Tp::UIntList &remotePendingMembers)
 
uint selfHandle () const
 
void setSelfHandle (uint selfHandle)
 
Tp::HandleIdentifierMap memberIdentifiers () const
 
void setAddMembersCallback (const AddMembersCallback &cb)
 
void addMembers (const Tp::UIntList &contacts, const QString &message, DBusError *error)
 
void setRemoveMembersCallback (const RemoveMembersCallback &cb)
 
void removeMembers (const Tp::UIntList &contacts, const QString &message, uint reason, DBusError *error)
 
- Public Member Functions inherited from Tp::AbstractChannelInterface
 AbstractChannelInterface (const QString &interfaceName)
 
virtual ~AbstractChannelInterface ()
 
- Public Member Functions inherited from Tp::AbstractDBusServiceInterface
 AbstractDBusServiceInterface (const QString &interfaceName)
 
virtual ~AbstractDBusServiceInterface ()
 
QString interfaceName () const
 
DBusObjectdbusObject () const
 
bool isRegistered () const
 
bool notifyPropertyChanged (const QString &propertyName, const QVariant &propertyValue)
 
- Public Member Functions inherited from Tp::Object
virtual ~Object ()
 
- Public Member Functions inherited from Tp::RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 

Static Public Member Functions

static BaseChannelGroupInterfacePtr create ()
 
template<typename BaseChannelGroupInterfaceSubclass >
static SharedPtr< BaseChannelGroupInterfaceSubclass > create ()
 

Protected Member Functions

 BaseChannelGroupInterface ()
 
void setBaseChannel (BaseChannel *channel)
 
- Protected Member Functions inherited from Tp::AbstractChannelInterface
virtual void close ()
 
- Protected Member Functions inherited from Tp::AbstractDBusServiceInterface
virtual bool registerInterface (DBusObject *dbusObject)
 
- Protected Member Functions inherited from Tp::Object
 Object ()
 
void notify (const char *propertyName)
 

Additional Inherited Members

- Signals inherited from Tp::Object
void propertyChanged (const QString &propertyName)
 

Detailed Description

Base class for implementations of Channel.Interface.Group.

Interface for channels which have multiple members, and where the members of the channel can change during its lifetime. Your presence in the channel cannot be presumed by the channel's existence (for example, a channel you may request membership of but your request may not be granted).

This interface implements three lists: a list of current members, and two lists of local pending and remote pending members. Contacts on the remote pending list have been invited to the channel, but the remote user has not accepted the invitation. Contacts on the local pending list have requested membership of the channel, but the local user of the framework must accept their request before they may join. A single contact should never appear on more than one of the three lists. The lists are empty when the channel is created, and the MembersChanged signal (and, if the channel's GroupFlags contains Tp::ChannelGroupFlagMembersChangedDetailed, the MembersChangedDetailed signal) should be emitted when information is retrieved from the server, or changes occur.

Addition of members to the channel may be requested by using AddMembers. If remote acknowledgement is required, use of the AddMembers method will cause users to appear on the remote pending list. If no acknowledgement is required, AddMembers will add contacts to the member list directly. If a contact is awaiting authorisation on the local pending list, AddMembers will grant their membership request.

Removal of contacts from the channel may be requested by using RemoveMembers. If a contact is awaiting authorisation on the local pending list, RemoveMembers will refuse their membership request. If a contact is on the remote pending list but has not yet accepted the invitation, RemoveMembers will rescind the request if possible.

It should not be presumed that the requester of a channel implementing this interface is immediately granted membership, or indeed that they are a member at all, unless they appear in the list. They may, for instance, be placed into the remote pending list until a connection has been established or the request acknowledged remotely.

If the local user joins a Group channel whose members or other state cannot be discovered until the user joins (e.g. many chat room implementations), the connection manager should ensure that the channel is, as far as possible, in a consistent state before adding the local contact to the members set; until this happens, the local contact should be in the remote-pending set. For instance, if the connection manager queries the server to find out the initial members list for the channel, it should leave the local contact in the remote-pending set until it has finished receiving the initial members list.

If the protocol provides no reliable way to tell whether the complete initial members list has been received yet, the connection manager should make a best-effort attempt to wait for the full list (in the worst case, waiting for a suitable arbitrary timeout) rather than requiring user interfaces to do so on its behalf.

Minimal implementation of the interface should setup group flags (setGroupFlags()) and have a setMembers() call. If the selfHandle is present in the group, then the setSelfHandle() should be used to correctly setup the interface. Regardless of the group flags, the connection manager implementation should setup removeMembers callback in order to let client leave the group gracefully. If doing so fails with Tp::ChannelGroupChangeReasonPermissionDenied, this is considered to a bug in the connection manager, but clients MUST recover by falling back to closing the channel with the Close method.

Depending on the protocol capabilities, addMembers() and removeMembers() callbacks can be setup to support group members addition, invitation and removal.

Note, that the interface automatically update the MemberIdentifiers property on members changes.

See also
setGroupFlags(), setSelfHandle(), setMembers(), setAddMembersCallback(), setRemoveMembersCallback(), setHandleOwners(), setLocalPendingMembers(), setRemotePendingMembers()

Member Typedef Documentation

Constructor & Destructor Documentation

Tp::BaseChannelGroupInterface::~BaseChannelGroupInterface ( )
virtual

Class destructor.

Tp::BaseChannelGroupInterface::BaseChannelGroupInterface ( )
protected

Class constructor.

Member Function Documentation

static BaseChannelGroupInterfacePtr Tp::BaseChannelGroupInterface::create ( )
inlinestatic
template<typename BaseChannelGroupInterfaceSubclass >
static SharedPtr<BaseChannelGroupInterfaceSubclass> Tp::BaseChannelGroupInterface::create ( )
inlinestatic
QVariantMap Tp::BaseChannelGroupInterface::immutableProperties ( ) const
virtual

Return the immutable properties of this interface.

There is no immutable properties presented on the interface.

Returns
The immutable properties of this interface.

Implements Tp::AbstractDBusServiceInterface.

Tp::ChannelGroupFlags Tp::BaseChannelGroupInterface::groupFlags ( ) const

Return the flags on this channel.

The user interface can use this property to present information about which operations are currently valid.

Returns
An the flags on this channel.
See also
setGroupFlags()
Tp::ChannelGroupFlag
void Tp::BaseChannelGroupInterface::setGroupFlags ( const Tp::ChannelGroupFlags flags)

Set the group flags for this channel.

The user interface can use this to present information about which operations are currently valid. Take a note, that Tp::ChannelGroupFlagProperties and Tp::ChannelGroupFlagMembersChangedDetailed flags setted up unconditionally. This way we always provide modern properties (ChannelGroupFlagProperties) and automatically emit signal MembersChangedDetailed. There is no reason to behave differently and this improve compatibility with future Telepathy specs.

Parameters
flagsThe flags on this channel.
See also
groupFlags()
Tp::ChannelGroupFlag
Tp::UIntList Tp::BaseChannelGroupInterface::members ( ) const

Return a list of this channel members.

The members of this channel.

Returns
A list of this channel members.
void Tp::BaseChannelGroupInterface::setMembers ( const Tp::UIntList members,
const QVariantMap &  details 
)

Set the list of current members of the channel.

Set the list of current members. Added members would be automatically removed from the local and remote pending lists.

Parameters
membersThe actual list of members of the channel.
detailsThe map with an information about the change.
See also
members()
setMembers(const UIntList &, const Tp::LocalPendingInfoList &, const Tp::UIntList &, const QVariantMap &)
localPendingMembers()
remotePendingMembers()
void Tp::BaseChannelGroupInterface::setMembers ( const Tp::UIntList members,
const Tp::LocalPendingInfoList localPending,
const Tp::UIntList remotePending,
const QVariantMap &  details 
)

Set the list of members of the channel.

Set the list of current members and update local and remote pending lists at the same time.

Parameters
membersThe actual list of members of the channel.
localPendingThe actual list of local pending members of the channel.
remotePendingThe actual list of remote pending members of the channel.
detailsThe map with an information about the change.
See also
members()
setMembers(const UIntList &, const QVariantMap &)
localPendingMembers()
remotePendingMembers()
Tp::HandleOwnerMap Tp::BaseChannelGroupInterface::handleOwners ( ) const

Return a map from channel-specific handles to their owners.

An integer representing the bitwise-OR of flags on this channel. The user interface can use this property to present information about which operations are currently valid.

Returns
A map from channel-specific handles to their owners.
void Tp::BaseChannelGroupInterface::setHandleOwners ( const Tp::HandleOwnerMap handleOwners)

Set a map from channel-specific handles to their owners.

A map from channel-specific handles to their owners, including at least all of the channel-specific handles in this channel's members, local-pending or remote-pending sets as keys. Any handle not in the keys of this mapping is not channel-specific in this channel. Handles which are channel-specific, but for which the owner is unknown, MUST appear in this mapping with 0 as owner.

Parameters
handleOwnersThe new (actual) handle owners map.
See also
handleOwners(), members(), localPendingMembers(), remotePendingMembers()
Tp::LocalPendingInfoList Tp::BaseChannelGroupInterface::localPendingMembers ( ) const

Return an array of contacts requesting channel membership

An array of structs containing handles representing contacts requesting channel membership and awaiting local approval with AddMembers call.

Returns
An array of contacts requesting channel membership
void Tp::BaseChannelGroupInterface::setLocalPendingMembers ( const Tp::LocalPendingInfoList localPendingMembers)

Set local pending members information list.

This method is recommended to use for the local pending members list changes. If the change affect the list and members list, use setMembers() instead.

Parameters
localPendingMembers
See also
localPendingMembers(), setRemotePendingMembers(), setMembers()
Tp::UIntList Tp::BaseChannelGroupInterface::remotePendingMembers ( ) const

Return an array of contacts requesting channel membership

An array of handles representing contacts who have been invited to the channel and are awaiting remote approval.

Returns
An array of contacts requesting channel membership
See also
setRemotePendingMembers()
void Tp::BaseChannelGroupInterface::setRemotePendingMembers ( const Tp::UIntList remotePendingMembers)

Set an array of contacts requesting channel membership

An array of handles representing contacts who have been invited to the channel and are awaiting remote approval.

This method is recommended to use for the remote pending members list changes. If the change affect the list and members list, use setMembers() instead.

Parameters
remotePendingMembersAn array of contacts requesting channel membership
See also
remotePendingMembers(), setLocalPendingMembers(), setMembers()
uint Tp::BaseChannelGroupInterface::selfHandle ( ) const

Return the handle of the user on this channel.

See setSelfHandle() for details.

Returns
The handle of the user on this channel.
void Tp::BaseChannelGroupInterface::setSelfHandle ( uint  selfHandle)

Set the handle for the user on this channel.

Set the handle for the user on this channel (which can also be a local or remote pending member), or 0 if the user is not a member at all (which is likely to be the case, for instance, on ContactList channels). Note that this is different from the result of Tp::Connection::selfHandle() on some protocols, so the value of this handle should always be used with the methods of this interface.

See also
selfHandle()
Tp::HandleIdentifierMap Tp::BaseChannelGroupInterface::memberIdentifiers ( ) const

Return the string identifiers for handles mentioned in this channel.

The string identifiers for handles mentioned in this channel, to give clients the minimal information necessary to create contacts without waiting for round-trips.

The property provided by the interface itself and based on selfHandle(), members(), localPendingMembers(), remotePendingMembers() and handleOwners() values.

Returns
The string identifiers for handles mentioned in this channel.
void Tp::BaseChannelGroupInterface::setAddMembersCallback ( const AddMembersCallback cb)

Set a callback that will be called to add members to the group.

Invite all the given contacts into the channel, or accept requests for channel membership for contacts on the pending local list.

A message may be provided along with the request, which will be sent to the server if supported. See the Tp::ChannelGroupFlag to find out in which cases the message should be provided.

Attempting to add contacts who are already members is allowed; connection managers must silently accept this, without error.

Parameters
cbThe callback to set.
See also
addMembers()
setRemoveMembersCallback()
void Tp::BaseChannelGroupInterface::addMembers ( const Tp::UIntList contacts,
const QString &  message,
DBusError error 
)

Call the AddMembers callback with passed arguments.

Parameters
contactsAn array of contact handles to invite to the channel.
messageA string message, which can be blank if desired.
errorA pointer to Tp::DBusError object for error information.
See also
setAddMembersCallback()
void Tp::BaseChannelGroupInterface::setRemoveMembersCallback ( const RemoveMembersCallback cb)

Set a callback that will be called to remove members from the group with a reason.

Connection manager should setup this callback to support requests for: the removal contacts from the channel, reject their request for channel membership on the pending local list, or rescind their invitation on the pending remote list.

If the SelfHandle is in the group, it can be removed via this method, in order to leave the group gracefully. This is the recommended way to leave a chatroom, close or reject a call, and so on.

Accordingly, connection managers SHOULD support doing this, regardless of the value of GroupFlags. If doing so fails with PermissionDenied, this is considered to a bug in the connection manager, but clients MUST recover by falling back to closing the channel with the Close method.

Removing any contact from the local pending list is always allowed. Removing contacts other than the SelfHandle from the channel's members is allowed if and only if Tp::ChannelGroupFlagCanRemove is in the groupFlags(), while removing contacts other than the SelfHandle from the remote pending list is allowed if and only if Tp::ChannelGroupFlagCanRescind is in the groupFlags().

A message may be provided along with the request, which will be sent to the server if supported. See the Tp::ChannelGroupFlag to find out in which cases the message should be provided.

The reason code may be ignored if the underlying protocol is unable to represent the given reason.

Parameters
cbThe callback to set.
See also
removeMembers()
setRemoveMembersCallback()
void Tp::BaseChannelGroupInterface::removeMembers ( const Tp::UIntList contacts,
const QString &  message,
uint  reason,
DBusError error 
)

Call the RemoveMembers callback with passed arguments.

Parameters
contactsAn array of contact handles to remove from the channel.
messageA string message, which can be blank if desired.
reasonA reason for the change.
errorA pointer to Tp::DBusError object for error information.
See also
setRemoveMembersCallback()
void Tp::BaseChannelGroupInterface::setBaseChannel ( BaseChannel channel)
protectedvirtual

Reimplemented from Tp::AbstractChannelInterface.


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