degesch: some non-functional changes
This commit is contained in:
parent
da472bc4f6
commit
8c38b1b9b8
54
degesch.c
54
degesch.c
@ -102,6 +102,25 @@ static struct config_item g_config_table[] =
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
struct nick_info
|
||||
{
|
||||
char *nickname; ///< Literal nickname
|
||||
char mode_char; ///< Op/voice/... character
|
||||
bool away; ///< User is away
|
||||
|
||||
// XXX: maybe a good candidate for deduplication (away status)
|
||||
};
|
||||
|
||||
static void
|
||||
nick_info_destroy (void *p)
|
||||
{
|
||||
struct nick_info *self = p;
|
||||
free (self->nickname);
|
||||
free (self);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
enum buffer_line_flags
|
||||
{
|
||||
BUFFER_LINE_HIGHLIGHT = 1 << 0 ///< The user was highlighted by this
|
||||
@ -153,25 +172,6 @@ buffer_line_destroy (struct buffer_line *self)
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
struct nick_info
|
||||
{
|
||||
char *nickname; ///< Literal nickname
|
||||
char mode_char; ///< Op/voice/... character
|
||||
bool away; ///< User is away
|
||||
|
||||
// XXX: maybe a good candidate for deduplication (away status)
|
||||
};
|
||||
|
||||
static void
|
||||
nick_info_destroy (void *p)
|
||||
{
|
||||
struct nick_info *self = p;
|
||||
free (self->nickname);
|
||||
free (self);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
enum buffer_type
|
||||
{
|
||||
BUFFER_GLOBAL, ///< Global information
|
||||
@ -187,6 +187,8 @@ struct buffer
|
||||
enum buffer_type type; ///< Type of the buffer
|
||||
char *name; ///< The name of the buffer
|
||||
|
||||
// Readline state:
|
||||
|
||||
HISTORY_STATE *history; ///< Saved history state
|
||||
char *saved_line; ///< Saved line
|
||||
int saved_point; ///< Saved position in line
|
||||
@ -258,6 +260,8 @@ struct app_context
|
||||
SSL_CTX *ssl_ctx; ///< SSL context
|
||||
SSL *ssl; ///< SSL connection
|
||||
|
||||
// TODO: channels?
|
||||
|
||||
// TODO: initialize and update these two values
|
||||
// TODO: probably issue a USERHOST message for ourselves after connecting
|
||||
// to enable proper word-wrapping; then store it here also, separately,
|
||||
@ -269,6 +273,7 @@ struct app_context
|
||||
|
||||
struct poller_fd tty_event; ///< Terminal input event
|
||||
struct poller_fd signal_event; ///< Signal FD event
|
||||
|
||||
struct poller_timer ping_tmr; ///< We should send a ping
|
||||
struct poller_timer timeout_tmr; ///< Connection seems to be dead
|
||||
struct poller_timer reconnect_tmr; ///< We should reconnect now
|
||||
@ -284,9 +289,9 @@ struct app_context
|
||||
|
||||
// XXX: when we go multiserver, there will be collisions
|
||||
struct str_map buffers_by_name; ///< Excludes GLOBAL and SERVER
|
||||
|
||||
struct buffer *global_buffer; ///< The global buffer
|
||||
struct buffer *server_buffer; ///< The server buffer
|
||||
|
||||
struct buffer *current_buffer; ///< The current buffer
|
||||
|
||||
// TODO: So that we always output proper date change messages
|
||||
@ -533,9 +538,6 @@ log_message_attributed (void *user_data, const char *quote, const char *fmt,
|
||||
{
|
||||
FILE *stream = stderr;
|
||||
|
||||
// GNU readline is a huge piece of total crap; it seems that we must do
|
||||
// these incredible shenanigans in order to intersperse readline output
|
||||
// with asynchronous status messages
|
||||
struct app_readline_state state;
|
||||
if (g_ctx->readline_prompt_shown)
|
||||
app_readline_hide (&state);
|
||||
@ -1324,7 +1326,7 @@ irc_establish_connection (struct app_context *ctx,
|
||||
// --- More readline funky stuff -----------------------------------------------
|
||||
|
||||
static char *
|
||||
get_unseen_prefix (struct app_context *ctx)
|
||||
make_unseen_prefix (struct app_context *ctx)
|
||||
{
|
||||
struct str active_buffers;
|
||||
str_init (&active_buffers);
|
||||
@ -1364,7 +1366,7 @@ make_prompt (struct app_context *ctx, struct str *output)
|
||||
|
||||
str_append_c (output, '[');
|
||||
|
||||
char *unseen_prefix = get_unseen_prefix (ctx);
|
||||
char *unseen_prefix = make_unseen_prefix (ctx);
|
||||
if (unseen_prefix)
|
||||
str_append_printf (output, "(%s) ", unseen_prefix);
|
||||
free (unseen_prefix);
|
||||
@ -1732,7 +1734,7 @@ try_decode_buffer (struct app_context *ctx, const char *word)
|
||||
if (xstrtoul (&n, word, 10) && n <= INT_MAX)
|
||||
buffer = buffer_at_index (ctx, n);
|
||||
if (!buffer)
|
||||
buffer = str_map_find (&ctx->buffers_by_name, word);
|
||||
buffer = buffer_by_name (ctx, word);
|
||||
// TODO: decode the global and server buffers, partial matches
|
||||
return buffer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user