telepathy-glib Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#include <telepathy-glib/group-mixin.h> gboolean (*TpGroupMixinAddMemberFunc) (GObject *obj
,TpHandle handle
,const gchar *message
,GError **error
); gboolean (*TpGroupMixinRemMemberFunc) (GObject *obj
,TpHandle handle
,const gchar *message
,GError **error
); gboolean (*TpGroupMixinRemMemberWithReasonFunc) (GObject *obj
,TpHandle handle
,const gchar *message
,guint reason
,GError **error
); TpGroupMixin; TpGroupMixinClass; void tp_group_mixin_class_init (GObjectClass *obj_cls
,glong offset
,TpGroupMixinAddMemberFunc add_func
,TpGroupMixinRemMemberFunc rem_func
); void tp_group_mixin_class_allow_self_removal (GObjectClass *obj_cls
); void tp_group_mixin_class_set_remove_with_reason_func (GObjectClass *cls
,TpGroupMixinRemMemberWithReasonFunc func
); void tp_group_mixin_init (GObject *obj
,glong offset
,TpHandleRepoIface *handle_repo
,TpHandle self_handle
); void tp_group_mixin_finalize (GObject *obj
); gboolean tp_group_mixin_get_self_handle (GObject *obj
,guint *ret
,GError **error
); gboolean tp_group_mixin_get_group_flags (GObject *obj
,guint *ret
,GError **error
); gboolean tp_group_mixin_add_members (GObject *obj
,const GArray *contacts
,const gchar *message
,GError **error
); gboolean tp_group_mixin_remove_members (GObject *obj
,const GArray *contacts
,const gchar *message
,GError **error
); gboolean tp_group_mixin_remove_members_with_reason (GObject *obj
,const GArray *contacts
,const gchar *message
,guint reason
,GError **error
); gboolean tp_group_mixin_get_members (GObject *obj
,GArray **ret
,GError **error
); gboolean tp_group_mixin_get_local_pending_members (GObject *obj
,GArray **ret
,GError **error
); gboolean tp_group_mixin_get_local_pending_members_with_info (GObject *obj
,GPtrArray **ret
,GError **error
); gboolean tp_group_mixin_get_remote_pending_members (GObject *obj
,GArray **ret
,GError **error
); gboolean tp_group_mixin_get_all_members (GObject *obj
,GArray **members
,GArray **local_pending
,GArray **remote_pending
,GError **error
); gboolean tp_group_mixin_get_handle_owners (GObject *obj
,const GArray *handles
,GArray **ret
,GError **error
); void tp_group_mixin_change_flags (GObject *obj
,TpChannelGroupFlags add
,TpChannelGroupFlags del
); gboolean tp_group_mixin_change_members (GObject *obj
,const gchar *message
,TpIntSet *add
,TpIntSet *del
,TpIntSet *add_local_pending
,TpIntSet *add_remote_pending
,TpHandle actor
,TpChannelGroupChangeReason reason
); gboolean tp_group_mixin_change_members_detailed (GObject *obj
,TpIntSet *add
,TpIntSet *del
,TpIntSet *add_local_pending
,TpIntSet *add_remote_pending
,const GHashTable *details
); void tp_group_mixin_add_handle_owner (GObject *obj
,TpHandle local_handle
,TpHandle owner_handle
); void tp_group_mixin_iface_init (gpointer g_iface
,gpointer iface_data
); void tp_group_mixin_add_handle_owners (GObject *obj
,GHashTable *local_to_owner_handle
); void tp_group_mixin_get_dbus_property (GObject *object
,GQuark interface
,GQuark name
,GValue *value
,gpointer unused
); void tp_group_mixin_init_dbus_properties (GObjectClass *cls
); void tp_group_mixin_change_self_handle (GObject *obj
,TpHandle new_self_handle
); void tp_external_group_mixin_iface_init (gpointer g_iface
,gpointer iface_data
); void tp_external_group_mixin_init (GObject *obj
,GObject *obj_with_mixin
); void tp_external_group_mixin_finalize (GObject *obj
); void tp_external_group_mixin_init_dbus_properties (GObjectClass *cls
); void tp_external_group_mixin_get_dbus_property (GObject *object
,GQuark interface
,GQuark name
,GValue *value
,gpointer unused
);
This mixin can be added to a channel GObject class to implement the groups interface in a general way.
To use the group mixin, include a TpGroupMixinClass somewhere in your
class structure and a TpGroupMixin somewhere in your instance structure,
and call tp_group_mixin_class_init()
from your class_init function,
tp_group_mixin_init()
from your init function or constructor, and
tp_group_mixin_finalize()
from your dispose or finalize function.
To use the group mixin as the implementation of
TpSvcChannelInterfaceGroup, call
G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP,
tp_group_mixin_iface_init)
in the fourth argument to
G_DEFINE_TYPE_WITH_CODE
.
Since 0.5.13 you can also implement the group interface by forwarding all
group operations to the group mixin of an associated object (mainly useful
for Tubes channels). To do this, call tp_external_group_mixin_init()
in the constructor after the associated object has been set,
tp_external_group_mixin_finalize()
in the dispose or finalize function, and
G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP,
tp_external_group_mixin_iface_init)
in the fourth argument to
G_DEFINE_TYPE_WITH_CODE
.
Since 0.7.10 you can also implement the properties of Group channels,
by calling tp_group_mixin_init_dbus_properties()
or
tp_external_group_mixin_init_dbus_properties()
(as appropriate).
gboolean (*TpGroupMixinAddMemberFunc) (GObject *obj
,TpHandle handle
,const gchar *message
,GError **error
);
Signature of the callback used to add a member to the group. This should perform the necessary operations in the underlying IM protocol to cause the member to be added.
gboolean (*TpGroupMixinRemMemberFunc) (GObject *obj
,TpHandle handle
,const gchar *message
,GError **error
);
Signature of the callback used to remove a member from the group. This should perform the necessary operations in the underlying IM protocol to cause the member to be removed.
gboolean (*TpGroupMixinRemMemberWithReasonFunc) (GObject *obj
,TpHandle handle
,const gchar *message
,guint reason
,GError **error
);
Signature of the callback used to remove a member from the group. This should perform the necessary operations in the underlying IM protocol to cause the member to be removed.
Set this with tp_group_mixin_class_set_remove_with_reason_func()
, .
|
An object implementing the group interface with this mixin |
|
The handle of the contact to be removed |
|
A message to be sent if the protocol supports it |
|
A TpChannelGroupChangeReason indicating the reason |
|
Used to return a Telepathy D-Bus error if FALSE is returned
|
Returns : |
TRUE on success, FALSE with error set on error
|
typedef struct { TpHandleRepoIface *handle_repo; TpHandle self_handle; TpChannelGroupFlags group_flags; TpHandleSet *members; TpHandleSet *local_pending; TpHandleSet *remote_pending; TpGroupMixinPrivate *priv; } TpGroupMixin;
Structure representing the group mixin as used in a particular class. To be placed in the implementation's instance structure.
All fields should be considered read-only.
TpHandleRepoIface * |
The connection's contact handle repository |
TpHandle |
The local user's handle within this group, or 0 if none.
Set using tp_group_mixin_init() and tp_group_mixin_change_self_handle() .
|
TpChannelGroupFlags |
This group's flags. Set using tp_group_mixin_change_flags() ;
defaults to 0.
|
TpHandleSet * |
The members of the group. Alter using
tp_group_mixin_change_members() .
|
TpHandleSet * |
Members awaiting the local user's approval to join the
group. Alter using tp_group_mixin_change_members() .
|
TpHandleSet * |
Members awaiting remote (e.g. remote user or server)
approval to join the group. Alter using tp_group_mixin_change_members() .
|
Pointer to opaque private data |
typedef struct { TpGroupMixinAddMemberFunc add_member; TpGroupMixinRemMemberFunc remove_member; TpGroupMixinClassPrivate *priv; } TpGroupMixinClass;
Structure representing the group mixin as used in a particular class. To be placed in the implementation's class structure.
Initialize this with tp_group_mixin_class_init()
.
All fields should be considered read-only.
TpGroupMixinAddMemberFunc |
The add-member function that was passed to
tp_group_mixin_class_init()
|
TpGroupMixinRemMemberFunc |
The remove-member function that was passed to
tp_group_mixin_class_init()
|
Pointer to opaque private data |
void tp_group_mixin_class_init (GObjectClass *obj_cls
,glong offset
,TpGroupMixinAddMemberFunc add_func
,TpGroupMixinRemMemberFunc rem_func
);
Configure the mixin for use with the given class.
|
The class of an object implementing the group interface using this mixin |
|
The offset of the TpGroupMixinClass structure within the class structure |
|
A callback to be used to add contacts to this group |
|
A callback to be used to remove contacts from this group.
This must be NULL if you will subsequently call
tp_group_mixin_class_set_remove_with_reason_func() .
|
void tp_group_mixin_class_allow_self_removal
(GObjectClass *obj_cls
);
Configure the mixin to allow attempts to remove the SelfHandle from this
Group, even if the group flags would otherwise disallow this. The
channel's TpGroupMixinRemMemberFunc or
TpGroupMixinRemMemberWithReasonFunc will be called as usual for such
attempts, and may make them fail with TP_ERROR_PERMISSION_DENIED
if
required.
This function should be called from the GObject class_init
callback,
after calling tp_group_mixin_class_init()
.
(Recent telepathy-spec changes make it valid to try to remove the self-handle at all times, regardless of group flags. However, if this was implemented automatically in TpGroupMixin, this would risk crashing connection manager implementations that assume that TpGroupMixin will enforce the group flags strictly. As a result, connection managers should call this function to indicate to the TpGroupMixin that it may call their removal callback with the self-handle regardless of flag settings.)
|
The class of an object implementing the group interface using this mixin |
Since 0.7.27
void tp_group_mixin_class_set_remove_with_reason_func (GObjectClass *cls
,TpGroupMixinRemMemberWithReasonFunc func
);
Set a callback to be used to implement RemoveMembers()
and
RemoveMembersWithReason()
. If this function is called during class
initialization, the given callback will be used instead of the remove
callback passed to tp_group_mixin_class_init()
(which must be NULL
in this case).
|
The class of an object implementing the group interface using this mixin |
|
A callback to be used to remove contacts from this group with a specified reason. |
Since 0.5.13
void tp_group_mixin_init (GObject *obj
,glong offset
,TpHandleRepoIface *handle_repo
,TpHandle self_handle
);
Initialize the mixin.
|
An object implementing the group interface using this mixin |
|
The offset of the TpGroupMixin structure within the instance structure |
|
The connection's handle repository for contacts |
|
The handle of the local user in this group, if any |
void tp_group_mixin_finalize (GObject *obj
);
Unreference handles and free resources used by this mixin.
|
An object implementing the group interface using this mixin |
gboolean tp_group_mixin_get_self_handle (GObject *obj
,guint *ret
,GError **error
);
Set the guint pointed to by ret to the local user's handle in this group, or to 0 if the local user is not present in this group.
|
An object implementing the group mixin using this interface |
|
Used to return the local user's handle in this group |
|
Unused |
Returns : |
TRUE .
|
gboolean tp_group_mixin_get_group_flags (GObject *obj
,guint *ret
,GError **error
);
Set the guint pointed to by ret to this group's flags, to be interpreted according to TpChannelGroupFlags.
|
An object implementing the group mixin using this interface |
|
Used to return the flags |
|
Unused |
Returns : |
TRUE
|
gboolean tp_group_mixin_add_members (GObject *obj
,const GArray *contacts
,const gchar *message
,GError **error
);
Request that the given contacts be added to the group as if in response to user action. If the group's flags prohibit this, raise PermissionDenied. If any of the handles is invalid, raise InvalidHandle. Otherwise attempt to add the contacts by calling the callbacks provided by the channel implementation.
gboolean tp_group_mixin_remove_members (GObject *obj
,const GArray *contacts
,const gchar *message
,GError **error
);
Request that the given contacts be removed from the group as if in response to user action. If the group's flags prohibit this, raise PermissionDenied. If any of the handles is invalid, raise InvalidHandle. If any of the handles is absent from the group, raise NotAvailable. Otherwise attempt to remove the contacts by calling the callbacks provided by the channel implementation.
gboolean tp_group_mixin_remove_members_with_reason (GObject *obj
,const GArray *contacts
,const gchar *message
,guint reason
,GError **error
);
Request that the given contacts be removed from the group as if in response to user action. If the group's flags prohibit this, raise PermissionDenied. If any of the handles is invalid, raise InvalidHandle. If any of the handles is absent from the group, raise NotAvailable. Otherwise attempt to remove the contacts by calling the callbacks provided by the channel implementation.
|
An object implementing the group interface using this mixin |
|
A GArray of guint representing contacts |
|
A message to be sent to those contacts, if supported |
|
A TpChannelGroupChangeReason |
|
Used to return an error if FALSE is returned
|
Returns : |
TRUE on success
|
gboolean tp_group_mixin_get_members (GObject *obj
,GArray **ret
,GError **error
);
Get the group's current members
|
An object implementing the group interface using this mixin |
|
Used to return a newly-allocated GArray of guint contact handles |
|
Unused |
Returns : |
TRUE
|
gboolean tp_group_mixin_get_local_pending_members (GObject *obj
,GArray **ret
,GError **error
);
Get the group's local-pending members.
|
An object implementing the group interface using this mixin |
|
Used to return a newly-allocated GArray of guint contact handles |
|
Unused |
Returns : |
TRUE
|
gboolean tp_group_mixin_get_local_pending_members_with_info (GObject *obj
,GPtrArray **ret
,GError **error
);
Get the group's local-pending members and information about their requests to join the channel.
|
An object implementing the group interface using this mixin |
|
Used to return a newly-allocated GPtrArray of D-Bus structures each containing the handle of a local-pending contact, the handle of a contact responsible for adding them to the group (or 0), the reason code and a related message (e.g. their request to join the group) |
|
Unused |
Returns : |
TRUE
|
gboolean tp_group_mixin_get_remote_pending_members (GObject *obj
,GArray **ret
,GError **error
);
Get the group's remote-pending members.
|
An object implementing the group interface using this mixin |
|
Used to return a newly-allocated GArray of guint representing the handles of the group's remote pending members |
|
Unused |
Returns : |
TRUE
|
gboolean tp_group_mixin_get_all_members (GObject *obj
,GArray **members
,GArray **local_pending
,GArray **remote_pending
,GError **error
);
Get the group's current and pending members.
|
An object implementing the group interface using this mixin |
|
Used to return a newly-allocated GArray of guint representing the handles of the group's members |
|
Used to return a newly-allocated GArray of guint representing the handles of the group's local pending members |
|
Used to return a newly-allocated GArray of guint representing the handles of the group's remote pending members |
|
Unused |
Returns : |
TRUE
|
gboolean tp_group_mixin_get_handle_owners (GObject *obj
,const GArray *handles
,GArray **ret
,GError **error
);
If the mixin has the flag TP_CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES
,
return the global owners of the given local handles, or 0 where
unavailable.
|
An object implementing the group interface with this mixin |
|
An array of guint representing locally valid handles |
|
Used to return an array of guint representing globally valid
handles, or 0 where unavailable, if TRUE is returned
|
|
Used to return an error if FALSE is returned
|
Returns : |
TRUE (setting ret ) on success, FALSE (setting error ) on
failure
|
void tp_group_mixin_change_flags (GObject *obj
,TpChannelGroupFlags add
,TpChannelGroupFlags del
);
Request a change to be made to the flags. If any flags were actually set or cleared, emits the GroupFlagsChanged signal with the changes.
It is an error to set any of the same bits in both add
and del
.
Changed in 0.7.7: the signal is not emitted if adding add
and
removing del
had no effect on the existing group flags.
|
An object implementing the groups interface using this mixin |
|
Flags to be added |
|
Flags to be removed |
gboolean tp_group_mixin_change_members (GObject *obj
,const gchar *message
,TpIntSet *add
,TpIntSet *del
,TpIntSet *add_local_pending
,TpIntSet *add_remote_pending
,TpHandle actor
,TpChannelGroupChangeReason reason
);
Change the sets of members as given by the arguments, and emit the MembersChanged and MembersChangedDetailed signals if the changes were not a no-op.
This function must be called in response to events on the underlying IM protocol, and must not be called in direct response to user input; it does not respect the permissions flags, but changes the group directly.
If any two of add, del, add_local_pending and add_remote_pending have a non-empty intersection, the result is undefined. Don't do that.
Each of the TpIntSet arguments may be NULL
, which is treated as
equivalent to an empty set.
|
An object implementing the group interface using this mixin |
|
A message to be sent to the affected contacts if possible;
NULL is allowed, and is mapped to an empty string
|
|
A set of contact handles to be added to the members (if not already present) and removed from local pending and remote pending (if present) |
|
A set of contact handles to be removed from members, local pending or remote pending, wherever they are present |
|
A set of contact handles to be added to local pending, and removed from members and remote pending |
|
A set of contact handles to be added to remote pending, and removed from members and local pending |
|
The handle of the contact responsible for this change |
|
The reason for this change |
Returns : |
TRUE if the group was changed and the MembersChanged(Detailed)
signals were emitted; FALSE if nothing actually changed and the signals
were suppressed.
|
gboolean tp_group_mixin_change_members_detailed (GObject *obj
,TpIntSet *add
,TpIntSet *del
,TpIntSet *add_local_pending
,TpIntSet *add_remote_pending
,const GHashTable *details
);
Change the sets of members as given by the arguments, and emit the MembersChanged and MembersChangedDetailed signals if the changes were not a no-op.
This function must be called in response to events on the underlying IM protocol, and must not be called in direct response to user input; it does not respect the permissions flags, but changes the group directly.
If any two of add, del, add_local_pending and add_remote_pending have a non-empty intersection, the result is undefined. Don't do that.
Each of the TpIntSet arguments may be NULL
, which is treated as
equivalent to an empty set.
details may contain, among other entries, the well-known keys (and corresponding type, wrapped in a GValue) defined by the Group.MembersChangedDetailed signal's specification; these include "actor" (a handle as G_TYPE_UINT), "change-reason" (an element of TpChannelGroupChangeReason as G_TYPE_UINT), "message" (G_TYPE_STRING), "error" (G_TYPE_STRING), "debug-message" (G_TYPE_STRING).
If all of the information in details could be passed to
tp_group_mixin_change_members()
then calling this function instead provides
no benefit. Calling this function without setting
TP_CHANNEL_GROUP_FLAG_MEMBERS_CHANGED_DETAILED with
tp_group_mixin_change_members()
first is not very useful, as clients will
not know to listen for MembersChangedDetailed and thus will miss the
details.
|
An object implementing the group interface using this mixin |
|
A set of contact handles to be added to the members (if not already present) and removed from local pending and remote pending (if present) |
|
A set of contact handles to be removed from members, local pending or remote pending, wherever they are present |
|
A set of contact handles to be added to local pending, and removed from members and remote pending |
|
A set of contact handles to be added to remote pending, and removed from members and local pending |
|
a map from strings to GValues detailing the change |
Returns : |
TRUE if the group was changed and the MembersChanged(Detailed)
signals were emitted; FALSE if nothing actually changed and the signals
were suppressed.
since 0.7.21
|
void tp_group_mixin_add_handle_owner (GObject *obj
,TpHandle local_handle
,TpHandle owner_handle
);
Note that the given local handle is an alias within this group for the given globally-valid handle. It will be returned from subsequent GetHandleOwner queries where appropriate.
Changed in 0.7.10: The owner_handle
may be 0. To comply with telepathy-spec
0.17.6, before adding any channel-specific handle to the members,
local-pending members or remote-pending members, you must call either
this function or tp_group_mixin_add_handle_owners()
.
|
A GObject implementing the group interface with this mixin |
|
A contact handle valid within this group (may not be 0) |
|
A contact handle valid globally, or 0 if the owner of the
local_handle is unknown
|
void tp_group_mixin_iface_init (gpointer g_iface
,gpointer iface_data
);
Fill in the vtable entries needed to implement the group interface using this mixin. This function should usually be called via G_IMPLEMENT_INTERFACE.
|
A TpSvcChannelInterfaceGroupClass |
|
Unused |
void tp_group_mixin_add_handle_owners (GObject *obj
,GHashTable *local_to_owner_handle
);
Note that the given local handles are aliases within this group for the given globally-valid handles.
To comply with telepathy-spec 0.17.6, before adding any channel-specific
handle to the members, local-pending members or remote-pending members, you
must call either this function or tp_group_mixin_add_handle_owner()
.
since
0.7.10
|
A GObject implementing the group interface with this mixin |
|
A map from contact handles valid within this group (which may not be 0) to either contact handles valid globally, or 0 if the owner of the corresponding key is unknown; all handles are stored using GUINT_TO_POINTER |
void tp_group_mixin_get_dbus_property (GObject *object
,GQuark interface
,GQuark name
,GValue *value
,gpointer unused
);
An implementation of TpDBusPropertiesMixinGetter which assumes that the
object
has the group mixin. It can only be used for the Group interface.
|
An object with this mixin |
|
Must be TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP
|
|
A quark representing the D-Bus property name, either "GroupFlags", "HandleOwners", "LocalPendingMembers", "Members", "RemotePendingMembers" or "SelfHandle" |
|
A GValue pre-initialized to the right type, into which to put the value |
|
Ignored |
Since 0.7.10
void tp_group_mixin_init_dbus_properties (GObjectClass *cls
);
Set up TpDBusPropertiesMixinClass to use this mixin's implementation of the Group interface's properties.
This uses tp_group_mixin_get_dbus_property()
as the property getter and
sets up a list of the supported properties for it. Having called this, you
should add TP_CHANNEL_GROUP_FLAG_PROPERTIES to any channels of this class
with tp_group_mixin_change_flags()
to indicate that the DBus properties are
available.
|
The class of an object with this mixin |
Since 0.7.10
void tp_group_mixin_change_self_handle (GObject *obj
,TpHandle new_self_handle
);
Change the self-handle for this group to the given value.
|
An object implementing the group interface using this mixin |
|
The new self-handle for this group |
void tp_external_group_mixin_iface_init (gpointer g_iface
,gpointer iface_data
);
Fill in the vtable entries needed to implement the group interface using the group mixin of another object. This function should usually be called via G_IMPLEMENT_INTERFACE.
|
A TpSvcChannelInterfaceGroupClass |
|
Unused |
Since 0.5.13
void tp_external_group_mixin_init (GObject *obj
,GObject *obj_with_mixin
);
Fill in the qdata needed to implement the group interface using the group mixin of another object. This function should usually be called in the instance constructor.
|
An object implementing the groups interface using an external group mixin |
|
A GObject with the group mixin |
Since 0.5.13
void tp_external_group_mixin_finalize (GObject *obj
);
Remove the external group mixin. This function should usually be called in the dispose or finalize function.
|
An object implementing the groups interface using an external group mixin |
Since 0.5.13
void tp_external_group_mixin_init_dbus_properties
(GObjectClass *cls
);
Set up TpDBusPropertiesMixinClass to use this mixin's implementation of the Group interface's properties.
This uses tp_group_mixin_get_dbus_property()
as the property getter and
sets up a list of the supported properties for it. Having called this, you
should add TP_CHANNEL_GROUP_FLAG_PROPERTIES to channels containing the
mixin used by this class with tp_group_mixin_change_flags()
to indicate that
the DBus properties are available.
|
The class of an object with this mixin |
Since 0.7.10
void tp_external_group_mixin_get_dbus_property (GObject *object
,GQuark interface
,GQuark name
,GValue *value
,gpointer unused
);
An implementation of TpDBusPropertiesMixinGetter which assumes that the
object
has the external group mixin. It can only be used for the Group
interface.
|
An object with this mixin |
|
Must be TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP
|
|
A quark representing the D-Bus property name, either "GroupFlags", "HandleOwners", "LocalPendingMembers", "Members", "RemotePendingMembers" or "SelfHandle" |
|
A GValue pre-initialized to the right type, into which to put the value |
|
Ignored |
Since 0.7.10