Top |
TpHandleRepoIface is implemented by TpDynamicHandleRepo and TpStaticHandleRepo.
Abstract interface of a repository for handles, supporting operations which include checking for validity, lookup by string value and lookup by numeric value. See TpDynamicHandleRepo and TpStaticHandleRepo for concrete implementations.
gboolean tp_handle_is_valid (TpHandleRepoIface *self
,TpHandle handle
,GError **error
);
self |
A handle repository implementation |
|
handle |
A handle of the type stored in the repository |
|
error |
Set to InvalidHandle if |
gboolean tp_handles_are_valid (TpHandleRepoIface *self
,const GArray *handles
,gboolean allow_zero
,GError **error
);
gboolean tp_handles_supported_and_valid (TpHandleRepoIface *repos[TP_NUM_ENTITY_TYPES]
,TpEntityType entity_type
,const GArray *handles
,gboolean allow_zero
,GError **error
);
Return TRUE
if the given entity type is supported (i.e. repos[entity_type]
is not NULL
) and the given handles are all valid in that repository.
If not, set error
and return FALSE
.
repos |
An array of possibly null pointers to handle repositories, indexed by entity type, where a null pointer means an unsupported handle type |
|
entity_type |
The entity type |
|
handles |
A GArray of guint32 representing handles of the given type |
|
allow_zero |
If |
|
error |
Used to return an error if |
const char * tp_handle_inspect (TpHandleRepoIface *self
,TpHandle handle
);
TpHandle tp_handle_ensure (TpHandleRepoIface *self
,const gchar *id
,gpointer context
,GError **error
);
Return a handle for the given string, creating one if necessary. The string is normalized, if possible.
TpHandle tp_handle_lookup (TpHandleRepoIface *self
,const gchar *id
,gpointer context
,GError **error
);
Return the handle for the given string. The string is normalized if possible. If no handle already exists for the string, none is created.
void tp_handle_ensure_async (TpHandleRepoIface *self
,TpBaseConnection *connection
,const gchar *id
,gpointer context
,GAsyncReadyCallback callback
,gpointer user_data
);
Asyncronously normalize an identifier and create an handle for it. This could
involve a server round-trip. This should be used instead of
tp_handle_ensure()
for user provided contact identifiers, but it is not
necessary for identifiers from the server.
self |
A handle repository implementation |
|
connection |
the TpBaseConnection using this handle repo |
|
id |
A string whose handle is required |
|
context |
User data to be passed to the normalization callback |
|
callback |
a callback to call when the operation finishes |
|
user_data |
data to pass to |
Since 0.19.2
TpHandle tp_handle_ensure_finish (TpHandleRepoIface *self
,GAsyncResult *result
,GError **error
);
Finishes tp_handle_ensure_async()
Since 0.19.2
#define TP_TYPE_HANDLE_SET (tp_handle_set_get_type ())
The boxed type of a TpHandleSet.
Since 0.11.6
void (*TpHandleSetMemberFunc) (TpHandleSet *set
,TpHandle handle
,gpointer userdata
);
Signature of the callback used to iterate over the handle set in
tp_handle_set_foreach()
.
set |
The set of handles on which |
|
handle |
A handle in the set |
|
userdata |
Arbitrary user data as supplied to |
TpHandleSet *
tp_handle_set_new (TpHandleRepoIface *repo
);
Creates a new TpHandleSet
TpHandleSet * tp_handle_set_new_containing (TpHandleRepoIface *repo
,TpHandle handle
);
Creates a new TpHandleSet from a specified handle repository and single handle.
repo |
TpHandleRepoIface that holds the handles to be reffed by this set |
|
handle |
a valid handle |
Since 0.13.0
TpHandleSet * tp_handle_set_new_from_array (TpHandleRepoIface *repo
,const GArray *array
);
Creates a new TpHandleSet
repo |
TpHandleRepoIface that holds the handles to be reffed by this set |
|
array |
array of handles to be referenced by this set. |
[element-type guint32] |
Since 0.11.7
TpHandleSet * tp_handle_set_new_from_intset (TpHandleRepoIface *repo
,const TpIntset *intset
);
Creates a new TpHandleSet from a specified handle repository and set of handles.
repo |
TpHandleRepoIface that holds the handles to be reffed by this set |
|
intset |
a set of handles, which must all be valid |
Since 0.13.0
TpHandleSet *
tp_handle_set_copy (const TpHandleSet *other
);
Creates a new TpHandleSet with the same contents as other
.
Since 0.11.6
void
tp_handle_set_clear (TpHandleSet *set
);
Remove every handle from set
, releasing the references it holds.
Since 0.11.6
void
tp_handle_set_destroy (TpHandleSet *set
);
Delete a TpHandleSet and unreference any handles that it holds
void tp_handle_set_add (TpHandleSet *set
,TpHandle handle
);
Add a handle to a TpHandleSet, and reference it in the attached TpHandleRepoIface
gboolean tp_handle_set_remove (TpHandleSet *set
,TpHandle handle
);
Remove a handle from a TpHandleSet, and unreference it in the attached TpHandleRepoIface
gboolean tp_handle_set_is_member (const TpHandleSet *set
,TpHandle handle
);
Check if the handle is in this set
void tp_handle_set_foreach (TpHandleSet *set
,TpHandleSetMemberFunc func
,gpointer user_data
);
Call func
(set
, handle
, userdata
) for each handle in set
.
gboolean
tp_handle_set_is_empty (const TpHandleSet *set
);
Return the same thing as (tp_handle_set_size (set) == 0)
,
but calculated more efficiently.
Since 0.11.6
GVariant *
tp_handle_set_to_identifier_map (TpHandleSet *self
);
Returns a dictionary mapping each handle in self
to the corresponding
identifier, as if retrieved by calling tp_handle_inspect()
on each handle.
TpIntset * tp_handle_set_update (TpHandleSet *set
,const TpIntset *add
);
Add a set of handles to a handle set, referencing those which are not already members. The TpIntset returned must be freed with tp_intset_destroy.
TpIntset * tp_handle_set_difference_update (TpHandleSet *set
,const TpIntset *remove
);
Remove a set of handles from a handle set, dereferencing those which are members. The TpIntset returned must be freed with tp_intset_destroy.
If you want to be able to inspect the handles in the set returned,
you must ensure that this function does not cause their refcount to drop
to zero, for instance by temporarily taking a reference to all the
handles in remove
, calling this function, doing something with the
result and discarding the temporary references.
gchar *
tp_handle_set_dump (const TpHandleSet *self
);
Format a TpHandleSet for debug output.
typedef struct _TpHandleRepoIface TpHandleRepoIface;
Dummy typedef representing any implementation of this interface.
typedef struct _TpHandleRepoIfaceClass TpHandleRepoIfaceClass;
The class of a handle repository interface. The structure layout is only available within telepathy-glib, for the handle repository implementations' benefit.
typedef struct _TpHandleSet TpHandleSet;
A set of handles. This is similar to a TpIntset (and implemented using one), but adding a handle to the set also references it.
“entity-type”
property“entity-type” guint
The TpEntityType held in this handle repository.
Flags: Read / Write / Construct Only
Default value: 0