/* 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 */
/* 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. */
#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();
#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;
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;
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);