comparison finch/gntcertmgr.c @ 21098:7e200a629109

explicit merge of '8f24e3576448fefbc861e06f1e8d5fe17db2e71a' and '49d0219884ede2c6c571f2df73e29dffa86f54ad'
author Richard Laager <rlaager@wiktel.com>
date Sun, 14 Oct 2007 02:13:14 +0000
parents 285bb637a2b7
children 8c9aad9479c0
comparison
equal deleted inserted replaced
21093:5e46cdf9ef2b 21098:7e200a629109
80 crt = purple_certificate_import(x509, filename); 80 crt = purple_certificate_import(x509, filename);
81 81
82 if (crt != NULL) { 82 if (crt != NULL) {
83 gchar *default_hostname; 83 gchar *default_hostname;
84 default_hostname = purple_certificate_get_subject_name(crt); 84 default_hostname = purple_certificate_get_subject_name(crt);
85 purple_request_input(NULL, 85 purple_request_input_with_hint(NULL,
86 _("Certificate Import"), 86 _("Certificate Import"),
87 _("Specify a hostname"), 87 _("Specify a hostname"),
88 _("Type the host name this certificate is for."), 88 _("Type the host name this certificate is for."),
89 default_hostname, FALSE, FALSE, NULL, 89 default_hostname, FALSE, FALSE, NULL,
90 _("OK"), G_CALLBACK(tls_peers_mgmt_import_ok2_cb), 90 _("OK"), G_CALLBACK(tls_peers_mgmt_import_ok2_cb),
91 _("Cancel"), G_CALLBACK(tls_peers_mgmt_import_cancel2_cb), 91 _("Cancel"), G_CALLBACK(tls_peers_mgmt_import_cancel2_cb),
92 NULL, NULL, NULL, 92 NULL, NULL, NULL,
93 crt); 93 "certmgr", crt);
94 g_free(default_hostname); 94 g_free(default_hostname);
95 } else { 95 } else {
96 gchar * secondary; 96 gchar * secondary;
97 secondary = g_strdup_printf(_("File %s could not be imported.\nMake sure that the file is readable and in PEM format.\n"), filename); 97 secondary = g_strdup_printf(_("File %s could not be imported.\nMake sure that the file is readable and in PEM format.\n"), filename);
98 purple_notify_error(NULL, 98 purple_notify_error(NULL,
104 } 104 }
105 105
106 static void 106 static void
107 add_cert_cb(GntWidget *button, gpointer null) 107 add_cert_cb(GntWidget *button, gpointer null)
108 { 108 {
109 purple_request_file(NULL, 109 purple_request_file_with_hint(NULL,
110 _("Select a PEM certificate"), 110 _("Select a PEM certificate"),
111 "certificate.pem", 111 "certificate.pem",
112 FALSE, 112 FALSE,
113 G_CALLBACK(tls_peers_mgmt_import_ok_cb), 113 G_CALLBACK(tls_peers_mgmt_import_ok_cb),
114 NULL, 114 NULL,
115 NULL, NULL, NULL, NULL ); 115 NULL, NULL, NULL, "certmgr", NULL );
116 } 116 }
117 117
118 /* Save certs in some file */ 118 /* Save certs in some file */
119 static void 119 static void
120 tls_peers_mgmt_export_ok_cb(gpointer data, const char *filename) 120 tls_peers_mgmt_export_ok_cb(gpointer data, const char *filename)
153 purple_debug_error("gntcertmgr/tls_peers_mgmt", 153 purple_debug_error("gntcertmgr/tls_peers_mgmt",
154 "Id %s was not in the peers cache?!\n", key); 154 "Id %s was not in the peers cache?!\n", key);
155 return; 155 return;
156 } 156 }
157 157
158 purple_request_file((void*)key, 158 purple_request_file_with_hint((void*)key,
159 _("PEM X.509 Certificate Export"), 159 _("PEM X.509 Certificate Export"),
160 "certificate.pem", TRUE, 160 "certificate.pem", TRUE,
161 G_CALLBACK(tls_peers_mgmt_export_ok_cb), 161 G_CALLBACK(tls_peers_mgmt_export_ok_cb),
162 G_CALLBACK(purple_certificate_destroy), 162 G_CALLBACK(purple_certificate_destroy),
163 NULL, NULL, NULL, 163 NULL, NULL, NULL,
164 crt); 164 "certmgr", crt);
165 } 165 }
166 166
167 /* Show information about a cert */ 167 /* Show information about a cert */
168 static void 168 static void
169 info_cert_cb(GntWidget *button, gpointer null) 169 info_cert_cb(GntWidget *button, gpointer null)
231 return; 231 return;
232 232
233 primary = g_strdup_printf(_("Really delete certificate for %s?"), key); 233 primary = g_strdup_printf(_("Really delete certificate for %s?"), key);
234 234
235 purple_request_close_with_handle((void *)key); 235 purple_request_close_with_handle((void *)key);
236 purple_request_yes_no((void *)key, _("Confirm certificate delete"), 236 purple_request_yes_no_with_hint((void *)key, _("Confirm certificate delete"),
237 primary, NULL, 237 primary, NULL,
238 2, 238 2,
239 NULL, NULL, NULL, 239 NULL, NULL, NULL, "certmgr",
240 g_strdup(key), 240 g_strdup(key),
241 tls_peers_mgmt_delete_confirm_cb, 241 tls_peers_mgmt_delete_confirm_cb,
242 g_free); 242 g_free);
243 243
244 g_free(primary); 244 g_free(primary);