+ static struct poptOption silc_options[] = {
+ { NULL, '\0', POPT_ARG_CALLBACK, (void *)&silc_opt_callback, '\0', NULL },
+ { "show-key", 'S', POPT_ARG_STRING, NULL, 0,
+ "Show the contents of the public key", "FILE" },
+ { "list-ciphers", 'c', POPT_ARG_NONE, NULL, 0,
+ "List supported ciphers", NULL },
+ { "list-hash-funcs", 'H', POPT_ARG_NONE, NULL, 0,
+ "List supported hash functions", NULL },
+ { "list-hmacs", 'M', POPT_ARG_NONE, NULL, 0,
+ "List supported HMACs", NULL },
+ { "list-pkcs", 'P', POPT_ARG_NONE, NULL, 0,
+ "List supported PKCSs", NULL },
+ { "debug", 'd', POPT_ARG_STRING, NULL, 0,
+ "Enable debugging", "STRING" },
+ { NULL, '\0', 0, NULL }
+ };
+
+ static struct poptOption options[] = {
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, silc_options, 0, NULL, NULL },
+ { "create-key-pair", 'C', POPT_ARG_NONE, &opt_create_keypair, 0,
+ "Create new public key pair", NULL },
+ { "pkcs", 0, POPT_ARG_STRING, &opt_pkcs, 0,
+ "Set the PKCS of the public key pair", "PKCS" },
+ { "bits", 0, POPT_ARG_INT, &opt_bits, 0,
+ "Set the length of the public key pair", "VALUE" },
+ { NULL, '\0', 0, NULL }
+ };
+
+ CHAT_PROTOCOL_REC *rec;
+ SilcClientParams params;
+ const char *def_cipher, *def_hash, *def_hmac;
+
+ args_register(options);
+ signal_add("irssi init read settings", (SIGNAL_FUNC) sig_init_read_settings);
+
+ /* Settings */
+ settings_add_bool("server", "skip_motd", FALSE);
+ settings_add_str("server", "alternate_nick", NULL);
+ settings_add_bool("server", "use_auto_addr", FALSE);
+ settings_add_str("server", "auto_bind_ip", "");
+ settings_add_str("server", "auto_public_ip", "");
+ settings_add_int("server", "auto_bind_port", 0);
+ settings_add_str("server", "crypto_default_cipher", SILC_DEFAULT_CIPHER);
+ settings_add_str("server", "crypto_default_hash", SILC_DEFAULT_HASH);
+ settings_add_str("server", "crypto_default_hmac", SILC_DEFAULT_HMAC);
+ settings_add_int("server", "key_exchange_timeout_secs", 120);
+ settings_add_int("server", "key_exchange_rekey_secs", 3600);
+ settings_add_int("server", "connauth_request_secs", 2);
+
+ silc_init_userinfo();
+
+ /* Initialize client parameters */
+ memset(¶ms, 0, sizeof(params));
+ strcat(params.nickname_format, "%n@%h%a");
+ params.nickname_parse = silc_nickname_format_parse;
+ params.rekey_secs = settings_get_int("key_exchange_rekey_secs");
+ params.connauth_request_secs = settings_get_int("connauth_request_secs");
+
+ /* Allocate SILC client */
+ silc_client = silc_client_alloc(&ops, ¶ms, NULL, silc_version_string);
+
+ /* Get the ciphers and stuff from config file */
+ def_cipher = settings_get_str("crypto_default_cipher");
+ def_hash = settings_get_str("crypto_default_hash");
+ def_hmac = settings_get_str("crypto_default_hmac");
+ silc_register_cipher(silc_client, def_cipher);
+ silc_register_hash(silc_client, def_hash);
+ silc_register_hmac(silc_client, def_hmac);
+ silc_pkcs_register_default();
+
+ /* Get user information */
+ silc_client->username = g_strdup(settings_get_str("user_name"));
+ silc_client->nickname = g_strdup(settings_get_str("nick"));
+ silc_client->hostname = silc_net_localhost();
+ silc_client->realname = g_strdup(settings_get_str("real_name"));
+
+ /* Check ~/.silc directory and public and private keys */
+ if (silc_client_check_silc_dir() == FALSE) {
+ idletag = -1;
+ return;
+ }