Home · All Classes · All Namespaces · Modules · Functions · Files |
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 |
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) |
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.
typedef Callback3<void, const Tp::UIntList &, const QString &, DBusError*> Tp::BaseChannelGroupInterface::AddMembersCallback |
typedef Callback4<void, const Tp::UIntList &, const QString &, uint, DBusError*> Tp::BaseChannelGroupInterface::RemoveMembersCallback |
|
virtual |
Class destructor.
|
protected |
Class constructor.
|
inlinestatic |
|
inlinestatic |
|
virtual |
Return the immutable properties of this interface.
There is no immutable properties presented on the 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.
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.
flags | The flags on this channel. |
Tp::UIntList Tp::BaseChannelGroupInterface::members | ( | ) | const |
Return a list of this channel members.
The members of this channel.
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.
members | The actual list of members of the channel. |
details | The map with an information about the change. |
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.
members | The actual list of members of the channel. |
localPending | The actual list of local pending members of the channel. |
remotePending | The actual list of remote pending members of the channel. |
details | The map with an information about the change. |
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.
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.
handleOwners | The new (actual) handle owners map. |
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.
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.
localPendingMembers |
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.
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.
remotePendingMembers | An array of contacts requesting channel membership |
uint Tp::BaseChannelGroupInterface::selfHandle | ( | ) | const |
Return the handle of the user on this channel.
See setSelfHandle() for details.
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.
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.
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.
cb | The callback to set. |
void Tp::BaseChannelGroupInterface::addMembers | ( | const Tp::UIntList & | contacts, |
const QString & | message, | ||
DBusError * | error | ||
) |
Call the AddMembers callback with passed arguments.
contacts | An array of contact handles to invite to the channel. |
message | A string message, which can be blank if desired. |
error | A pointer to Tp::DBusError object for error information. |
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.
cb | The callback to set. |
void Tp::BaseChannelGroupInterface::removeMembers | ( | const Tp::UIntList & | contacts, |
const QString & | message, | ||
uint | reason, | ||
DBusError * | error | ||
) |
Call the RemoveMembers callback with passed arguments.
contacts | An array of contact handles to remove from the channel. |
message | A string message, which can be blank if desired. |
reason | A reason for the change. |
error | A pointer to Tp::DBusError object for error information. |
|
protectedvirtual |
Reimplemented from Tp::AbstractChannelInterface.
Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation | Telepathy-Qt 0.9.7 |