diff options
author | LemonBoy <thatlemon@gmail.com> | 2015-11-19 15:31:32 +0100 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2015-11-19 15:31:32 +0100 |
commit | d7ef9c590fa679403da103f8e89042aad6abb919 (patch) | |
tree | 57918bbb2547999742dbda8514b7945d3a83ddcf /src/irc/core/irc-channels.c | |
parent | fbb838b3b0d30ee41de648d667fa89a2d6b41076 (diff) | |
download | irssi-d7ef9c590fa679403da103f8e89042aad6abb919.zip |
Correctly alias 'channel' to '#channel'
Use the same approach used in 'irc_channels_join'.
Remove 'irc_nick_strip' since it was unused.
Diffstat (limited to 'src/irc/core/irc-channels.c')
-rw-r--r-- | src/irc/core/irc-channels.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/irc/core/irc-channels.c b/src/irc/core/irc-channels.c index 682be4c2..e775f530 100644 --- a/src/irc/core/irc-channels.c +++ b/src/irc/core/irc-channels.c @@ -174,6 +174,13 @@ static CHANNEL_REC *irc_channel_find_server(SERVER_REC *server, const char *channel) { GSList *tmp; + char *fmt_channel; + + /* if 'channel' has no leading # this lookup is going to fail, add a + * octothorpe in front of it to handle this case. */ + fmt_channel = server_ischannel(SERVER(server), channel) ? + g_strdup(channel) : + g_strdup_printf("#%s", channel); for (tmp = server->channels; tmp != NULL; tmp = tmp->next) { CHANNEL_REC *rec = tmp->data; @@ -182,13 +189,19 @@ static CHANNEL_REC *irc_channel_find_server(SERVER_REC *server, continue; /* check both !ABCDEchannel and !channel */ - if (IRC_SERVER(server)->nick_comp_func(channel, rec->name) == 0) + if (IRC_SERVER(server)->nick_comp_func(fmt_channel, rec->name) == 0) { + g_free(fmt_channel); return rec; + } - if (IRC_SERVER(server)->nick_comp_func(channel, rec->visible_name) == 0) + if (IRC_SERVER(server)->nick_comp_func(fmt_channel, rec->visible_name) == 0) { + g_free(fmt_channel); return rec; + } } + g_free(fmt_channel); + return NULL; } |