summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-08-30 16:47:38 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-08-30 16:47:38 +0000
commit37b0d5ebb084e79f9555bb4e391cfda382c46356 (patch)
treeb9c43cc73dc42631164973c9ae96aa9e040206d1 /lib
parent9f836a1ed8d0ef118ae538594d0909b68100a133 (diff)
message.rb: try to handle situations where the source isn't an Irc::User
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/message.rb15
1 files 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?