Top |
TpDynamicHandleRepoTpDynamicHandleRepo — general handle repository implementation, with dynamic handle allocation and recycling |
gpointer | default-normalize-context | Read / Write / Construct Only |
gpointer | normalize-function | Read / Write / Construct Only |
A dynamic handle repository will accept arbitrary handles, which can be created and destroyed at runtime.
The “entity-type” property must be set at construction time; the “normalize-function” property may be set to perform validation and normalization on handle ID strings.
Most connection managers will use this for all supported entity types
except TP_ENTITY_TYPE_LIST
.
Changed in 0.13.8: handles are no longer reference-counted, and the reference-count-related functions are stubs. Instead, handles remain valid until the handle repository is destroyed.
TpHandle tp_dynamic_handle_repo_lookup_exact (TpHandleRepoIface *irepo
,const char *id
);
Look up a name in the repository, returning the corresponding handle if it is present in the repository, without creating a new reference.
Unlike tp_handle_lookup()
this function does not perform any normalization;
it just looks for the literal string you requested. This can be useful to
call from normalization callbacks (for instance, Gabble's contacts
repository uses it to see whether we already know that a JID belongs
to a multi-user chat room member).
TpHandleRepoIface * tp_dynamic_handle_repo_new (TpEntityType entity_type
,TpDynamicHandleRepoNormalizeFunc normalize_func
,gpointer default_normalize_context
);
entity_type |
The entity type |
|
normalize_func |
The function to be used to normalize and validate handles,
or |
|
default_normalize_context |
The context pointer to be passed to the
|
void tp_dynamic_handle_repo_set_normalize_async (TpDynamicHandleRepo *self
,TpDynamicHandleRepoNormalizeAsync normalize_async
,TpDynamicHandleRepoNormalizeFinish normalize_finish
);
Set an asynchronous normalization function. This is to be used if handle
normalization requires a server round-trip. See tp_handle_ensure_async()
.
Since 0.19.2
gchar * (*TpDynamicHandleRepoNormalizeFunc) (TpHandleRepoIface *repo
,const gchar *id
,gpointer context
,GError **error
);
Signature of the normalization function optionally used by TpDynamicHandleRepo instances.
repo |
The repository on which |
|
id |
The name to be normalized |
|
context |
Arbitrary context passed to |
|
error |
Used to raise the Telepathy error InvalidHandle with an appropriate message if NULL is returned |
void (*TpDynamicHandleRepoNormalizeAsync) (TpHandleRepoIface *repo
,TpBaseConnection *connection
,const gchar *id
,gpointer context
,GAsyncReadyCallback callback
,gpointer user_data
);
Signature of a function to asynchronously normalize an identifier. See
tp_dynamic_handle_repo_set_normalize_async()
.
repo |
The repository on which |
|
connection |
the TpBaseConnection using this handle repo |
|
id |
The name to be normalized |
|
context |
Arbitrary context passed to |
|
callback |
a callback to call when the operation finishes |
|
user_data |
data to pass to |
Since 0.19.2
gchar * (*TpDynamicHandleRepoNormalizeFinish) (TpHandleRepoIface *repo
,GAsyncResult *result
,GError **error
);
Signature of a function to finish the operation started with TpDynamicHandleRepoNormalizeAsync.
repo |
The repository on which |
|
result |
||
error |
a GError to fill |
Since 0.19.2
typedef struct _TpDynamicHandleRepo TpDynamicHandleRepo;
A dynamic handle repository. The contents of the struct are private.
“default-normalize-context”
property“default-normalize-context” gpointer
An optional default context given to the
“normalize-function” if NULL
is passed as context to
the ensure or lookup functions, e.g. when RequestHandle is called via
D-Bus. The default is NULL
.
Flags: Read / Write / Construct Only
“normalize-function”
property“normalize-function” gpointer
An optional TpDynamicHandleRepoNormalizeFunc used to validate and
normalize handle IDs. If NULL
(which is the default), any handle ID is
accepted as-is (equivalent to supplying a pointer to a function that just
calls g_strdup).
Flags: Read / Write / Construct Only