static GSList *systems = NULL;
+/**
+ * Register a new Privacy System
+ *
+ * \param system The Privacy System that should be registered
+ */
void privacy_register_system(PrivacySystem *system)
{
systems = g_slist_append(systems, system);
}
+/**
+ * Unregister a new Privacy System. The system must not be in
+ * use anymore when it is unregistered.
+ *
+ * \param system The Privacy System that should be unregistered
+ */
void privacy_unregister_system(PrivacySystem *system)
{
systems = g_slist_remove(systems, system);
}
+/**
+ * Free a PrivacyData of a PrivacySystem
+ *
+ * \param privacydata The data to free
+ */
void privacy_free_privacydata(PrivacyData *privacydata)
{
g_return_if_fail(privacydata != NULL);
privacydata->system->free_privacydata(privacydata);
}
+/**
+ * Check if a MimeInfo is signed with one of the available
+ * privacy system. If a privacydata is set in the MimeInfo
+ * it will directory return the return value by the system
+ * set in the privacy data or check all available privacy
+ * systems otherwise.
+ *
+ * \return True if the MimeInfo has a signature
+ */
gboolean privacy_mimeinfo_is_signed(MimeInfo *mimeinfo)
{
GSList *cur;
return FALSE;
}
+/**
+ * Check the signature of a MimeInfo. privacy_mimeinfo_is_signed
+ * should be called before otherwise it is done by this function.
+ * If the MimeInfo is not signed an error code will be returned.
+ *
+ * \return Error code indicating the result of the check,
+ * < 0 if an error occured
+ */
gint privacy_mimeinfo_check_signature(MimeInfo *mimeinfo)
{
PrivacySystem *system;
gboolean privacy_mimeinfo_is_encrypted(MimeInfo *mimeinfo)
{
+ GSList *cur;
g_return_val_if_fail(mimeinfo != NULL, FALSE);
+ for(cur = systems; cur != NULL; cur = g_slist_next(cur)) {
+ PrivacySystem *system = (PrivacySystem *) cur->data;
+
+ if(system->is_encrypted != NULL && system->is_encrypted(mimeinfo))
+ return TRUE;
+ }
+
return FALSE;
}
+
+gint privacy_mimeinfo_decrypt(MimeInfo *mimeinfo)
+{
+ return -1;
+}