From daec89e4c32c683674720ab458902654528a5f47 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 11 Aug 2008 09:00:18 +0200 Subject: [PATCH] rfc2812: handle ERR_NOSUCHNICK and ERR_NOSUCHCHANNEL Delete the corresponding user/channel from the server list (if present), and notify the client about the error. --- lib/rbot/rfc2812.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/rbot/rfc2812.rb b/lib/rbot/rfc2812.rb index 38ce64ca..42b8daf7 100644 --- a/lib/rbot/rfc2812.rb +++ b/lib/rbot/rfc2812.rb @@ -981,7 +981,6 @@ module Irc # # ==server events currently supported: # - # TODO handle errors ERR_NOSUCHNICK, ERR_NOSUCHCHANNEL # TODO handle errors ERR_CHANOPRIVSNEEDED, ERR_CANNOTSENDTOCHAN # # welcome:: server welcome message on connect @@ -1351,6 +1350,18 @@ module Irc data[:url] = argv[2] @server.channel(data[:channel]).url=data[:url].dup handle(:channel_url, data) + when ERR_NOSUCHNICK + data[:nick] = argv[1] + if user = @server.get_user(data[:nick]) + @server.delete_user(user) + end + handle(:nosuchnick, data) + when ERR_NOSUCHCHANNEL + data[:channel] = argv[1] + if channel = @server.get_channel(data[:channel]) + @server.delete_channel(channel) + end + handle(:nosuchchannel, data) else warning "Unknown message #{serverstring.inspect}" handle(:unknown, data) -- 2.39.5