Compare commits

...

4 Commits

Author SHA1 Message Date
Přemysl Eric Janouch e5156cddbf
xW: render leaked lines a bit more accurately
There is no need to reset all text attributes, just the colour.
2023-08-25 22:48:31 +02:00
Přemysl Eric Janouch 34521e61c1
xP/xW: fix buffer rename handling
Maintaining string pointers to the current/last buffer
means that renames invalidate them.
2023-08-25 22:48:31 +02:00
Přemysl Eric Janouch c22dd67fc1
xC: send missing relay events for newly added servers 2023-08-25 22:48:27 +02:00
Přemysl Eric Janouch 274d5f03e7
xC: give the /away command a proper handler
Multiple words should be passed to the server as a single argument.
2023-08-25 22:46:43 +02:00
3 changed files with 30 additions and 11 deletions

14
xC.c
View File

@ -9439,6 +9439,9 @@ server_add (struct app_context *ctx,
str_map_set (&ctx->servers, s->name, s);
s->config = subtree;
relay_prepare_server_update (ctx, s);
relay_broadcast (ctx);
// Add a buffer and activate it
struct buffer *buffer = s->buffer = buffer_new (ctx->input,
BUFFER_SERVER, irc_make_buffer_name (s, NULL));
@ -12937,6 +12940,16 @@ handle_command_kill (struct handler_args *a)
return true;
}
static bool
handle_command_away (struct handler_args *a)
{
if (*a->arguments)
irc_send (a->s, "AWAY :%s", a->arguments);
else
irc_send (a->s, "AWAY");
return true;
}
static bool
handle_command_nick (struct handler_args *a)
{
@ -13002,7 +13015,6 @@ TRIVIAL_HANDLER (who, "WHO")
TRIVIAL_HANDLER (motd, "MOTD")
TRIVIAL_HANDLER (oper, "OPER")
TRIVIAL_HANDLER (stats, "STATS")
TRIVIAL_HANDLER (away, "AWAY")
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -344,6 +344,11 @@ rpcEventHandlers.set(Relay.Event.BufferStats, e => {
rpcEventHandlers.set(Relay.Event.BufferRename, e => {
buffers.set(e.new, buffers.get(e.bufferName))
buffers.delete(e.bufferName)
if (e.bufferName === bufferCurrent)
bufferCurrent = e.new
if (e.bufferName === bufferLast)
bufferLast = e.new
})
rpcEventHandlers.set(Relay.Event.BufferRemove, e => {

View File

@ -678,14 +678,12 @@ buffer_print_line(std::vector<BufferLine>::const_iterator begin,
if (!prefix.empty())
richedit_replacesel(g.hwndBuffer, &pcf, prefix.c_str());
std::wstring text;
for (const auto &it : line->items)
text += it.text;
CHARFORMAT2 format = default_charformat();
format.dwEffects &= ~CFE_AUTOCOLOR;
format.crTextColor = GetSysColor(COLOR_GRAYTEXT);
richedit_replacesel(g.hwndBuffer, &format, text.c_str());
for (auto it : line->items) {
it.format.dwEffects &= ~CFE_AUTOCOLOR;
it.format.crTextColor = GetSysColor(COLOR_GRAYTEXT);
it.format.dwEffects |= CFE_AUTOBACKCOLOR;
richedit_replacesel(g.hwndBuffer, &it.format, it.text.c_str());
}
} else {
if (!prefix.empty())
richedit_replacesel(g.hwndBuffer, &pcf, prefix.c_str());
@ -914,11 +912,15 @@ relay_process_message(const Relay::EventMessage &m)
if (!b)
break;
b->buffer_name = data.buffer_name;
b->buffer_name = data.new_;
refresh_buffer_list();
if (b->buffer_name == g.buffer_current)
if (data.buffer_name == g.buffer_current) {
g.buffer_current = data.new_;
refresh_status();
}
if (data.buffer_name == g.buffer_last)
g.buffer_last = data.new_;
break;
}
case Relay::Event::BUFFER_REMOVE: