get_botuser_for(user).username
end
- def welcome(user)
- _("welcome, %{user}") % {:user => get_botusername_for(user)}
+ def say_welcome(m)
+ m.reply _("welcome, %{user}") % {:user => get_botusername_for(m.source)}
end
def auth_auth(m, params)
begin
case @bot.auth.login(m.source, params[:botuser], params[:password])
when true
- m.reply welcome(m.source)
+ say_welcome(m)
@bot.auth.set_changed
else
m.reply _("sorry, can't do")
if u.default?
m.reply _("I couldn't find anything to let you login automatically")
else
- m.reply welcome(m.source)
+ say_welcome(m)
end
end
@quiet = []
@client[:welcome] = proc {|data|
+ m = WelcomeMessage.new(self, server, data[:source], data[:target], data[:message])
+
irclog "joined server #{@client.server} as #{myself}", "server"
+ @plugins.delegate("welcome", m)
@plugins.delegate("connect")
@config['irc.join_channels'].each { |c|
end
+ # class for handling welcome messages from the server
+ class WelcomeMessage < BasicUserMessage
+ end
+
# class for handling IRC user messages. Includes some utilities for handling
# the message, for example in plugins.
# The +message+ member will have any bot addressing "^bot: " removed
Called when a user (or the bot) changes a channel
topic
+ welcome(WelcomeMessage)::
+ Called when the welcome message is received on
+ joining a server succesfully.
+
connect:: Called when a server is joined successfully, but
before autojoin channels are joined (no params)
num=command.to_i
case num
when RPL_WELCOME
+ data[:message] = argv[1]
# "Welcome to the Internet Relay Network
# <nick>!<user>@<host>"
if not_us
warning "Server thinks client (#{@user.inspect}) has a different nick"
@user.nick = data[:target]
end
- if argv[1] =~ /([^@!\s]+)(?:!([^@!\s]+?))?@(\S+)/
+ if data[:message] =~ /([^@!\s]+)(?:!([^@!\s]+?))?@(\S+)/
nick = $1
user = $2
host = $3