libpurple/protocols/silc/silc.c

changeset 27635
0cd19038c417
parent 26482
72d16a73cf12
child 27879
f53273ef4e7e
equal deleted inserted replaced
27634:3ee88d486d53 27635:0cd19038c417
323 purple_account_disconnect(purple_connection_get_account(gc)); 323 purple_account_disconnect(purple_connection_get_account(gc));
324 break; 324 break;
325 325
326 case SILC_CLIENT_CONN_ERROR: 326 case SILC_CLIENT_CONN_ERROR:
327 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 327 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
328 _("Error during connecting to SILC Server")); 328 _("Error connecting to SILC Server"));
329 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); 329 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account)));
330 break; 330 break;
331 331
332 case SILC_CLIENT_CONN_ERROR_KE: 332 case SILC_CLIENT_CONN_ERROR_KE:
333 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, 333 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
346 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); 346 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account)));
347 break; 347 break;
348 348
349 case SILC_CLIENT_CONN_ERROR_TIMEOUT: 349 case SILC_CLIENT_CONN_ERROR_TIMEOUT:
350 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 350 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
351 _("Connection Timeout")); 351 _("Connection timed out"));
352 break; 352 break;
353 } 353 }
354 354
355 /* Error */ 355 /* Error */
356 sg->conn = NULL; 356 sg->conn = NULL;
445 "silc.silcnet.org"), 445 "silc.silcnet.org"),
446 purple_account_get_int(account, "port", 706), 446 purple_account_get_int(account, "port", 706),
447 silcpurple_login_connected, gc) == NULL) 447 silcpurple_login_connected, gc) == NULL)
448 { 448 {
449 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 449 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
450 _("Unable to create connection")); 450 _("Unable to connect"));
451 gc->proto_data = NULL; 451 gc->proto_data = NULL;
452 silc_free(sg); 452 silc_free(sg);
453 return; 453 return;
454 } 454 }
455 } 455 }
488 if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), 488 if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd),
489 (char *)purple_account_get_string(account, "private-key", prd), 489 (char *)purple_account_get_string(account, "private-key", prd),
490 password, 490 password,
491 &sg->public_key, &sg->private_key)) { 491 &sg->public_key, &sg->private_key)) {
492 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, 492 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
493 _("Could not load SILC key pair")); 493 _("Unable to load SILC key pair"));
494 gc->proto_data = NULL; 494 gc->proto_data = NULL;
495 silc_free(sg); 495 silc_free(sg);
496 return; 496 return;
497 } 497 }
498 silcpurple_continue_running(sg); 498 silcpurple_continue_running(sg);
504 /* The password prompt dialog doesn't get disposed if the account disconnects */ 504 /* The password prompt dialog doesn't get disposed if the account disconnects */
505 if (!PURPLE_CONNECTION_IS_VALID(gc)) 505 if (!PURPLE_CONNECTION_IS_VALID(gc))
506 return; 506 return;
507 sg = gc->proto_data; 507 sg = gc->proto_data;
508 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, 508 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
509 _("Could not load SILC key pair")); 509 _("Unable to load SILC key pair"));
510 gc->proto_data = NULL; 510 gc->proto_data = NULL;
511 silc_free(sg); 511 silc_free(sg);
512 } 512 }
513 513
514 static void silcpurple_running(SilcClient client, void *context) 514 static void silcpurple_running(SilcClient client, void *context)
533 purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb), 533 purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb),
534 G_CALLBACK(silcpurple_no_password_cb), gc); 534 G_CALLBACK(silcpurple_no_password_cb), gc);
535 return; 535 return;
536 } 536 }
537 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, 537 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
538 _("Could not load SILC key pair")); 538 _("Unable to not load SILC key pair"));
539 gc->proto_data = NULL; 539 gc->proto_data = NULL;
540 silc_free(sg); 540 silc_free(sg);
541 return; 541 return;
542 } 542 }
543 silcpurple_continue_running(sg); 543 silcpurple_continue_running(sg);
615 615
616 /* Init SILC client */ 616 /* Init SILC client */
617 if (!silc_client_init(client, username, hostname, realname, 617 if (!silc_client_init(client, username, hostname, realname,
618 silcpurple_running, sg)) { 618 silcpurple_running, sg)) {
619 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, 619 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
620 _("Cannot initialize SILC protocol")); 620 _("Unable to initialize SILC protocol"));
621 gc->proto_data = NULL; 621 gc->proto_data = NULL;
622 silc_free(sg); 622 silc_free(sg);
623 silc_free(hostname); 623 silc_free(hostname);
624 g_free(username); 624 g_free(username);
625 return; 625 return;

mercurial