From 37b0d5ebb084e79f9555bb4e391cfda382c46356 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 30 Aug 2007 16:47:38 +0000 Subject: [PATCH] message.rb: try to handle situations where the source isn't an Irc::User --- lib/rbot/message.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb index 42042b88..c671e00a 100644 --- a/lib/rbot/message.rb +++ b/lib/rbot/message.rb @@ -150,13 +150,24 @@ module Irc # Access the nick of the source # def sourcenick - @source.nick + if @source.reply_to?(:nick) + @source.nick + else + @source.to_s + end end # Access the user@host of the source # def sourceaddress - "#{@source.user}@#{@source.host}" + str = String.new + if @source.reply_to?(:user) + str << @source.user.to_s + end + if @source.reply_to?(:host) + str << @source.host.to_s + end + str end # Was the message from an identified user? -- 2.39.5