Various fixes related to channel modes
Bugs unnoticed for so long.
This commit is contained in:
parent
eb70bf3fbc
commit
8e668ff31a
10
NEWS
10
NEWS
@ -1,4 +1,4 @@
|
||||
0.9.5 (2016-??-??)
|
||||
0.9.5 (2016-12-30)
|
||||
|
||||
* Better support for the KILL command
|
||||
|
||||
@ -8,12 +8,20 @@
|
||||
|
||||
* degesch: allow hiding join/part messages and other noise (Meta-Shift-H)
|
||||
|
||||
* degesch: allow autojoining channels with keys
|
||||
|
||||
* degesch: rejoin channels with keys on reconnect
|
||||
|
||||
* degesch: make /query without arguments just open the buffer
|
||||
|
||||
* degesch: add a censor plugin
|
||||
|
||||
* degesch: die on configuration parse errors
|
||||
|
||||
* degesch: request channel modes also on rejoin
|
||||
|
||||
* degesch: don't show remembered channel modes on parted channels
|
||||
|
||||
* degesch: fix highlight detection in colored text
|
||||
|
||||
* degesch: fix CTCP handling for the real world and don't decode X-QUOTEs
|
||||
|
38
degesch.c
38
degesch.c
@ -2360,7 +2360,7 @@ static struct config_schema g_config_server[] =
|
||||
.type = CONFIG_ITEM_BOOLEAN,
|
||||
.default_ = "on" },
|
||||
{ .name = "autojoin",
|
||||
.comment = "Channels to join on start",
|
||||
.comment = "Channels to join on start (e.g. \"#abc,#def key,#ghi\")",
|
||||
.type = CONFIG_ITEM_STRING_ARRAY,
|
||||
.validate = config_validate_nonjunk_string },
|
||||
{ .name = "command",
|
||||
@ -4996,7 +4996,7 @@ on_irc_autojoin_timeout (void *user_data)
|
||||
cstr_split (autojoin, ",", true, &v);
|
||||
for (size_t i = 0; i < v.len; i++)
|
||||
{
|
||||
irc_send (s, "JOIN :%s", v.vector[i]);
|
||||
irc_send (s, "JOIN %s", v.vector[i]);
|
||||
str_map_set (&joins_sent, v.vector[i], (void *) 1);
|
||||
}
|
||||
str_vector_free (&v);
|
||||
@ -5007,9 +5007,21 @@ on_irc_autojoin_timeout (void *user_data)
|
||||
str_map_iter_init (&iter, &s->irc_channels);
|
||||
struct channel *channel;
|
||||
while ((channel = str_map_iter_next (&iter)))
|
||||
{
|
||||
struct str target;
|
||||
str_init (&target);
|
||||
str_append (&target, channel->name);
|
||||
|
||||
const char *key;
|
||||
if ((key = str_map_find (&channel->param_modes, "k")))
|
||||
str_append_printf (&target, " %s", key);
|
||||
|
||||
// When a channel is both autojoined and rejoined, both keys are tried
|
||||
if (!channel->left_manually
|
||||
&& !str_map_find (&joins_sent, channel->name))
|
||||
irc_send (s, "JOIN :%s", channel->name);
|
||||
&& !str_map_find (&joins_sent, target.str))
|
||||
irc_send (s, "JOIN %s", target.str);
|
||||
str_free (&target);
|
||||
}
|
||||
|
||||
str_map_free (&joins_sent);
|
||||
}
|
||||
@ -5912,7 +5924,9 @@ make_prompt (struct app_context *ctx, struct str *output)
|
||||
|
||||
str_append_printf (output, "%d:%s",
|
||||
buffer_get_index (ctx, buffer), buffer->name);
|
||||
if (buffer->type == BUFFER_CHANNEL)
|
||||
// We remember old modes, don't show them while we're not on the channel
|
||||
if (buffer->type == BUFFER_CHANNEL
|
||||
&& buffer->channel->users_len)
|
||||
{
|
||||
struct str modes;
|
||||
str_init (&modes);
|
||||
@ -5921,8 +5935,7 @@ make_prompt (struct app_context *ctx, struct str *output)
|
||||
str_append_printf (output, "(+%s)", modes.str);
|
||||
str_free (&modes);
|
||||
|
||||
if (buffer->channel->users_len)
|
||||
str_append_printf (output, "{%zu}", buffer->channel->users_len);
|
||||
str_append_printf (output, "{%zu}", buffer->channel->users_len);
|
||||
}
|
||||
if (buffer->hide_unimportant)
|
||||
str_append (output, "<H>");
|
||||
@ -6522,8 +6535,16 @@ irc_handle_join (struct server *s, const struct irc_message *msg)
|
||||
|
||||
buffer_add (s->ctx, buffer);
|
||||
buffer_activate (s->ctx, buffer);
|
||||
}
|
||||
|
||||
if (irc_is_this_us (s, msg->prefix))
|
||||
{
|
||||
// Reset the field so that we rejoin the channel after reconnecting
|
||||
channel->left_manually = false;
|
||||
|
||||
// Request the channel mode as we don't get it automatically
|
||||
str_reset (&channel->no_param_modes);
|
||||
str_map_clear (&channel->param_modes);
|
||||
irc_send (s, "MODE %s", channel_name);
|
||||
}
|
||||
|
||||
@ -6531,9 +6552,6 @@ irc_handle_join (struct server *s, const struct irc_message *msg)
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
// Reset the field so that we rejoin the channel after reconnecting
|
||||
channel->left_manually = false;
|
||||
|
||||
// Add the user to the channel
|
||||
char *nickname = irc_cut_nickname (msg->prefix);
|
||||
irc_channel_link_user (channel, irc_get_or_make_user (s, nickname), "");
|
||||
|
@ -51,14 +51,14 @@ local prompt = degesch.hook_prompt (function (hook)
|
||||
end
|
||||
if active ~= "" then active = "(" .. active .. ")" end
|
||||
local x = current_n .. ":" .. current.name
|
||||
if chan then
|
||||
if chan and chan.users_len ~= 0 then
|
||||
local params = ""
|
||||
for mode, param in pairs (chan.param_modes) do
|
||||
params = params .. " +" .. mode .. " " .. param
|
||||
end
|
||||
local modes = chan.no_param_modes .. params:sub (3)
|
||||
if modes ~= "" then x = x .. "(+" .. modes .. ")" end
|
||||
if chan.users_len ~= 0 then x = x .. "{" .. chan.users_len .. "}" end
|
||||
x = x .. "{" .. chan.users_len .. "}"
|
||||
end
|
||||
if current.hide_unimportant then x = x .. "<H>" end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user