From 695624b615ef594b1cc8709e7e9ec797a81c829e Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sat, 26 May 2001 08:05:09 +0000 Subject: [PATCH] updates. --- apps/irssi/src/silc/core/clientutil.c | 61 ++------------------------- apps/irssi/src/silc/core/clientutil.h | 4 +- apps/irssi/src/silc/core/silc-core.c | 19 +++------ 3 files changed, 13 insertions(+), 71 deletions(-) diff --git a/apps/irssi/src/silc/core/clientutil.c b/apps/irssi/src/silc/core/clientutil.c index 8b835b19..02b5d301 100644 --- a/apps/irssi/src/silc/core/clientutil.c +++ b/apps/irssi/src/silc/core/clientutil.c @@ -45,35 +45,9 @@ /* Asks yes/no from user on the input line. Returns TRUE on "yes" and FALSE on "no". */ -int silc_client_ask_yes_no(SilcClient client, char *prompt) +void silc_client_ask_yes_no(char *prompt, SIGNAL_FUNC func) { - char answer[4]; - int ret; - - again: - /* Print prompt */ - attroff(A_INVIS); - // silc_screen_input_print_prompt(app->screen, prompt); - - /* Get string */ - memset(answer, 0, sizeof(answer)); - echo(); - getnstr(answer, sizeof(answer)); - if (!strncasecmp(answer, "yes", strlen(answer)) || - !strncasecmp(answer, "y", strlen(answer))) { - ret = TRUE; - } else if (!strncasecmp(answer, "no", strlen(answer)) || - !strncasecmp(answer, "n", strlen(answer))) { - ret = FALSE; - } else { - printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Type yes or no"); - goto again; - } - noecho(); - - // silc_screen_input_reset(app->screen); - - return ret; + keyboard_entry_redirect(func, prompt, 0, NULL); } /* Lists supported (builtin) ciphers */ @@ -105,36 +79,9 @@ void silc_client_list_pkcs() /* Displays input prompt on command line and takes input data from user */ -char *silc_client_get_input(const char *prompt) +void silc_client_get_input(char *prompt, SIGNAL_FUNC func) { -#if 0 - char input[2048]; - int fd; - - fd = open("/dev/tty", O_RDONLY); - if (fd < 0) { - fprintf(stderr, "silc: %s\n", strerror(errno)); - return NULL; - } - - memset(input, 0, sizeof(input)); - - printf("%s", prompt); - fflush(stdout); - - if ((read(fd, input, sizeof(input))) < 0) { - fprintf(stderr, "silc: %s\n", strerror(errno)); - return NULL; - } - - if (strlen(input) <= 1) - return NULL; - - if (strchr(input, '\n')) - *strchr(input, '\n') = '\0'; - return strdup(input); -#endif - return NULL; + keyboard_entry_redirect(func, prompt, 0, NULL); } /* Returns identifier string for public key generation. */ diff --git a/apps/irssi/src/silc/core/clientutil.h b/apps/irssi/src/silc/core/clientutil.h index f69a3688..aaded306 100644 --- a/apps/irssi/src/silc/core/clientutil.h +++ b/apps/irssi/src/silc/core/clientutil.h @@ -22,8 +22,8 @@ #define CLIENTUTIL_H /* Prototypes */ -int silc_client_ask_yes_no(SilcClient client, char *prompt); -char *silc_client_get_input(const char *prompt); +void silc_client_ask_yes_no(char *prompt, SIGNAL_FUNC func); +void silc_client_get_input(char *prompt, SIGNAL_FUNC func); void silc_client_list_ciphers(); void silc_client_list_hash_funcs(); void silc_client_list_pkcs(); diff --git a/apps/irssi/src/silc/core/silc-core.c b/apps/irssi/src/silc/core/silc-core.c index 10866c51..c13b0403 100644 --- a/apps/irssi/src/silc/core/silc-core.c +++ b/apps/irssi/src/silc/core/silc-core.c @@ -39,16 +39,6 @@ #include "fe-common/core/fe-channels.h" /* Command line option variables */ -static char *opt_server = NULL; -static int opt_port = 0; -static char *opt_nickname = NULL; -static char *opt_channel = NULL; -static char *opt_cipher = NULL; -static char *opt_public_key = NULL; -static char *opt_private_key = NULL; -static char *opt_config_file = NULL; -static bool opt_no_silcrc = FALSE; - static bool opt_create_keypair = FALSE; static char *opt_pkcs = NULL; static char *opt_keyfile = NULL; @@ -547,8 +537,6 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, list_count = va_arg(vp, uint32); client_id_list = va_arg(vp, SilcBuffer); - /* XXX what an earth do I do with the topic??? */ - if (!success) return; @@ -558,6 +546,13 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, else if (chanrec == NULL && success) chanrec = silc_channel_create(server, channel, TRUE); + if (topic) { + g_free_not_null(chanrec->topic); + chanrec->topic = *topic == '\0' ? NULL : g_strdup(topic); + signal_emit("channel topic changed", 1, chanrec); + silc_say(client, conn, "Topic for %s: %s", channel, topic); + } + mode = silc_client_chmode(modei, channel_entry); g_free_not_null(chanrec->mode); chanrec->mode = g_strdup(mode == NULL ? "" : mode); -- 2.24.0