~singpolyma/biboumi

d90c1978def803390203f0fada3621de8abba0e5 — Florent Le Coz 8 years ago fbec16f
Fix a bug when receiving a topic change

The number of arguments is not always the same
1 files changed, 4 insertions(+), 2 deletions(-)

M src/irc/irc_client.cpp
M src/irc/irc_client.cpp => src/irc/irc_client.cpp +4 -2
@@ 321,9 321,11 @@ void IrcClient::send_motd(const IrcMessage& message)

void IrcClient::on_topic_received(const IrcMessage& message)
{
  const std::string chan_name = utils::tolower(message.arguments[1]);
  if (message.arguments.size() < 2)
    return;
  const std::string chan_name = utils::tolower(message.arguments[message.arguments.size() - 2]);
  IrcChannel* channel = this->get_channel(chan_name);
  channel->topic = message.arguments[2];
  channel->topic = message.arguments[message.arguments.size() - 1];
  if (channel->joined)
    this->bridge->send_topic(this->hostname, chan_name, channel->topic);
}