Mercurial > pidgin
comparison libpurple/protocols/silc/util.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | 6135b24cdc8a |
children |
comparison
equal
deleted
inserted
replaced
32818:01ff09d4a463 | 32819:2c6510167895 |
---|---|
196 * Check Public and Private keys | 196 * Check Public and Private keys |
197 */ | 197 */ |
198 g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); | 198 g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); |
199 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); | 199 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); |
200 g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s", | 200 g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s", |
201 purple_account_get_string(gc->account, "public-key", pkd)); | 201 purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd)); |
202 g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s", | 202 g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s", |
203 purple_account_get_string(gc->account, "private-key", prd)); | 203 purple_account_get_string(purple_connection_get_account(gc), "private-key", prd)); |
204 | 204 |
205 if ((g_stat(file_public_key, &st)) == -1) { | 205 if ((g_stat(file_public_key, &st)) == -1) { |
206 /* If file doesn't exist */ | 206 /* If file doesn't exist */ |
207 if (errno == ENOENT) { | 207 if (errno == ENOENT) { |
208 purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); | 208 purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); |
209 if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, | 209 if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, |
210 SILCPURPLE_DEF_PKCS_LEN, | 210 SILCPURPLE_DEF_PKCS_LEN, |
211 file_public_key, | 211 file_public_key, |
212 file_private_key, NULL, | 212 file_private_key, NULL, |
213 (gc->password == NULL) | 213 (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), |
214 ? "" : gc->password, | |
215 NULL, NULL, FALSE)) { | 214 NULL, NULL, FALSE)) { |
216 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 215 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
217 _("Unable to create SILC key pair")); | 216 _("Unable to create SILC key pair")); |
218 return FALSE; | 217 return FALSE; |
219 } | 218 } |
220 | 219 |
221 if ((g_stat(file_public_key, &st)) == -1) { | 220 if ((g_stat(file_public_key, &st)) == -1) { |
251 purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); | 250 purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); |
252 if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, | 251 if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, |
253 SILCPURPLE_DEF_PKCS_LEN, | 252 SILCPURPLE_DEF_PKCS_LEN, |
254 file_public_key, | 253 file_public_key, |
255 file_private_key, NULL, | 254 file_private_key, NULL, |
256 (gc->password == NULL) | 255 (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), |
257 ? "" : gc->password, | |
258 NULL, NULL, FALSE)) { | 256 NULL, NULL, FALSE)) { |
259 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 257 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
260 _("Unable to create SILC key pair")); | 258 _("Unable to create SILC key pair")); |
261 return FALSE; | 259 return FALSE; |
262 } | 260 } |
263 | 261 |
264 if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { | 262 if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { |