Editable prompt. Not used for anything yet. More to come.

This commit is contained in:
Nicholas Marriott
2008-06-19 19:40:35 +00:00
parent 8078deea3f
commit c3b7a49cc1
6 changed files with 183 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $Id: server-fn.c,v 1.43 2008-06-19 18:27:55 nicm Exp $ */
/* $Id: server-fn.c,v 1.44 2008-06-19 19:40:34 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -48,6 +48,35 @@ server_clear_client_message(struct client *c)
c->flags |= CLIENT_STATUS;
}
void
server_set_client_prompt(
struct client *c, const char *msg, void (*fn)(void *, char *), void *data)
{
c->prompt_string = xstrdup(msg);
c->prompt_buffer = xstrdup("");
c->prompt_index = 0;
c->prompt_callback = fn;
c->prompt_data = data;
c->flags |= CLIENT_STATUS;
}
void
server_clear_client_prompt(struct client *c)
{
if (c->prompt_string == NULL)
return;
xfree(c->prompt_string);
c->prompt_string = NULL;
xfree(c->prompt_buffer);
c->flags |= CLIENT_STATUS;
}
void
server_write_client(
struct client *c, enum hdrtype type, const void *buf, size_t len)