void seahorse_gpgme_uid_set_userid (SeahorseGpgmeUid *self, gpgme_user_id_t userid) { SeahorsePgpUid *base; GObject *obj; gpgme_user_id_t uid; gchar *string; gint index, i; g_return_if_fail (SEAHORSE_IS_GPGME_UID (self)); g_return_if_fail (userid); if (self->pv->userid) g_return_if_fail (seahorse_gpgme_uid_is_same (self, userid)); /* Make sure that this userid is in the pubkey */ index = -1; for (i = 0, uid = self->pv->pubkey->uids; uid; ++i, uid = uid->next) { if(userid == uid) { index = i; break; } } g_return_if_fail (index >= 0); self->pv->userid = userid; self->pv->gpgme_index = index; obj = G_OBJECT (self); g_object_freeze_notify (obj); g_object_notify (obj, "userid"); g_object_notify (obj, "gpgme_index"); base = SEAHORSE_PGP_UID (self); string = convert_string (userid->comment); seahorse_pgp_uid_set_comment (base, string); g_free (string); string = convert_string (userid->email); seahorse_pgp_uid_set_email (base, string); g_free (string); string = convert_string (userid->name); seahorse_pgp_uid_set_name (base, string); g_free (string); realize_signatures (self); seahorse_pgp_uid_set_validity (base, seahorse_gpgme_convert_validity (userid->validity)); g_object_thaw_notify (obj); }
static void seahorse_pgp_uid_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { SeahorsePgpUid *self = SEAHORSE_PGP_UID (object); switch (prop_id) { case PROP_SIGNATURES: seahorse_pgp_uid_set_signatures (self, g_value_get_boxed (value)); break; case PROP_VALIDITY: seahorse_pgp_uid_set_validity (self, g_value_get_uint (value)); break; case PROP_NAME: seahorse_pgp_uid_set_name (self, g_value_get_string (value)); break; case PROP_EMAIL: seahorse_pgp_uid_set_email (self, g_value_get_string (value)); break; case PROP_COMMENT: seahorse_pgp_uid_set_comment (self, g_value_get_string (value)); break; } }
/* Add a key to the key source from an LDAP entry */ static void search_parse_key_from_ldap_entry (SeahorseLDAPSource *self, GcrSimpleCollection *results, LDAP *ldap, LDAPMessage *res) { const gchar *algo; long int timestamp; long int expires; gchar *fpr, *fingerprint; gchar *uidstr; gboolean revoked; gboolean disabled; int length; g_return_if_fail (ldap_msgtype (res) == LDAP_RES_SEARCH_ENTRY); fpr = get_string_attribute (ldap, res, "pgpcertid"); uidstr = get_string_attribute (ldap, res, "pgpuserid"); revoked = get_boolean_attribute (ldap, res, "pgprevoked"); disabled = get_boolean_attribute (ldap, res, "pgpdisabled"); timestamp = get_date_attribute (ldap, res, "pgpkeycreatetime"); expires = get_date_attribute (ldap, res, "pgpkeyexpiretime"); algo = get_algo_attribute (ldap, res, "pgpkeytype"); length = get_int_attribute (ldap, res, "pgpkeysize"); if (fpr && uidstr) { SeahorsePgpSubkey *subkey; SeahorsePgpKey *key; SeahorsePgpUid *uid; GList *list; guint flags; /* Build up a subkey */ subkey = seahorse_pgp_subkey_new (); seahorse_pgp_subkey_set_keyid (subkey, fpr); fingerprint = seahorse_pgp_subkey_calc_fingerprint (fpr); seahorse_pgp_subkey_set_fingerprint (subkey, fingerprint); g_free (fingerprint); seahorse_pgp_subkey_set_created (subkey, timestamp); seahorse_pgp_subkey_set_expires (subkey, expires); seahorse_pgp_subkey_set_algorithm (subkey, algo); seahorse_pgp_subkey_set_length (subkey, length); flags = SEAHORSE_FLAG_EXPORTABLE; if (revoked) flags |= SEAHORSE_FLAG_REVOKED; if (disabled) flags |= SEAHORSE_FLAG_DISABLED; seahorse_pgp_subkey_set_flags (subkey, flags); key = seahorse_pgp_key_new (); /* Build up a uid */ uid = seahorse_pgp_uid_new (key, uidstr); if (revoked) seahorse_pgp_uid_set_validity (uid, SEAHORSE_VALIDITY_REVOKED); /* Now build them into a key */ list = g_list_prepend (NULL, uid); seahorse_pgp_key_set_uids (key, list); seahorse_object_list_free (list); list = g_list_prepend (NULL, subkey); seahorse_pgp_key_set_subkeys (key, list); seahorse_object_list_free (list); g_object_set (key, "object-flags", flags, "place", self, NULL); seahorse_pgp_key_realize (key); gcr_simple_collection_add (results, G_OBJECT (key)); g_object_unref (key); } g_free (fpr); g_free (uidstr); }