From 962a5d24036546e820f54d94deab39fd4fcaaaa0 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 27 Apr 2009 08:19:30 +0000 Subject: new function lasso_profile_get_server() * lasso/id-ff/profile.c: * lasso/id-ff/profile.h: in a move to try to remove direct access to object content, add a function to retrieve the LassoServer object of a LassoProfile. * bindings/overrides.xml: it conflicts with direct access to the public field server, so we do not export it in the binding for now. --- lasso/id-ff/profile.c | 26 ++++++++++++++++++++++++++ lasso/id-ff/profile.h | 1 + 2 files changed, 27 insertions(+) (limited to 'lasso') diff --git a/lasso/id-ff/profile.c b/lasso/id-ff/profile.c index 650c29f7..b616228c 100644 --- a/lasso/id-ff/profile.c +++ b/lasso/id-ff/profile.c @@ -417,6 +417,32 @@ lasso_profile_set_artifact_message(LassoProfile *profile, char *message) profile->private_data->artifact_message = g_strdup(message); } +/** + * lasso_profile_get_server: + * @profile: a #LassoProfile object + * + * Return the #LassoServer linked to this profile object. A profile object should always contains + * one. It allows to find metadatas of other providers and to know our own metadatas. + * + * Return value: a #LassoServer or NULL if profile is not a #LassoProfile or no #LassoServer object + * was setup at the creation of this profile. + */ +LassoServer* +lasso_profile_get_server(LassoProfile *profile) +{ + g_return_val_if_fail(LASSO_IS_PROFILE(profile), NULL); + + if (profile->server) { + if (LASSO_IS_SERVER(profile->server)) { + return profile->server; + } else { + message(G_LOG_LEVEL_WARNING, "profile->server contains a non LassoServer object"); + } + } + + return NULL; +} + /*****************************************************************************/ /* private methods */ diff --git a/lasso/id-ff/profile.h b/lasso/id-ff/profile.h index 758af182..1a327cda 100644 --- a/lasso/id-ff/profile.h +++ b/lasso/id-ff/profile.h @@ -141,6 +141,7 @@ LASSO_EXPORT LassoNode* lasso_profile_get_nameIdentifier(LassoProfile *profile); LASSO_EXPORT char* lasso_profile_get_artifact(LassoProfile *profile); LASSO_EXPORT char* lasso_profile_get_artifact_message(LassoProfile *profile); LASSO_EXPORT void lasso_profile_set_artifact_message(LassoProfile *profile, char *message); +LASSO_EXPORT LassoServer* lasso_profile_get_server(LassoProfile *profile); #ifdef __cplusplus } -- cgit