changeset 10029:40676ea67757

[gaim-migrate @ 10965] A patch from Stu Tomlinson to keep SILC from asking the user to repeatedly set a key for a buddy. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Thu, 16 Sep 2004 01:50:15 +0000
parents 1ececa0e7072
children 0f5ad31051a0
files src/protocols/silc/buddy.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/silc/buddy.c	Thu Sep 16 01:48:42 2004 +0000
+++ b/src/protocols/silc/buddy.c	Thu Sep 16 01:50:15 2004 +0000
@@ -1020,7 +1020,7 @@
 	}
 
 	/* Open file selector to select the public key. */
-	gaim_request_file(NULL, _("Open..."), NULL, FALSE,
+	gaim_request_file(NULL, _("Open..."), "", FALSE,
 			  G_CALLBACK(silcgaim_add_buddy_ask_import),
 			  G_CALLBACK(silcgaim_add_buddy_ask_pk_cancel), r);
 }
@@ -1148,6 +1148,8 @@
 	SilcUInt32 pk_len;
 	const char *filename;
 
+	filename = gaim_blist_node_get_string((GaimBlistNode *)b, "public-key");
+
 	/* If the buddy is offline/nonexistent, we will require user
 	   to associate a public key with the buddy or the buddy
 	   cannot be added. */
@@ -1158,7 +1160,12 @@
 		}
 
 		r->offline = TRUE;
-		silcgaim_add_buddy_ask_pk(r);
+		/* If the user has already associated a public key, try loading it
+		 * before prompting the user to load it again */
+		if (filename != NULL)
+			silcgaim_add_buddy_ask_import(r, filename);
+		else
+			silcgaim_add_buddy_ask_pk(r);
 		return;
 	}
 
@@ -1201,8 +1208,6 @@
 	b->proto_data = silc_memdup(clients[0]->id, sizeof(*clients[0]->id));
 	r->client_id = *clients[0]->id;
 
-	filename = gaim_blist_node_get_string((GaimBlistNode *)b, "public-key");
-
 	/* Get the public key from attributes, if not present then
 	   resolve it with GETKEY unless we have it cached already. */
 	if (clients[0]->attrs && !clients[0]->public_key) {