lib/marvin/irc/server/user/handle_mixin.rb in Sutto-marvin-0.2.2 vs lib/marvin/irc/server/user/handle_mixin.rb in Sutto-marvin-0.2.3

- old
+ new

@@ -13,15 +13,17 @@ def handle_incoming_nick(opts = {}) nick = opts[:new_nick] if !nick.blank? && !Marvin::IRC::Server::UserStore.nick_taken?(nick.downcase) if !(new_nick = @nick.nil?) + logger.info "Reclaiming nick (if taken)" + Marvin::IRC::Server::UserStore.reclaim(nick) logger.debug "Notifying all users of nick change: #{@nick} => #{nick}" # Get all users and let them now we've changed nick from @nick to nick users = [self] @channels.each do |c| - users += c.members.values + users += c.members end users.uniq.each { |u| u.notify :NICK, nick, :prefix => prefix } dispatch :outgoing_nick, :nick => @nick, :new_nick => nick end # Update the store values @@ -60,11 +62,11 @@ dispatch :invalid_channel_name, :channel => channel, :client => self return end chan = (Marvin::IRC::Server::ChannelStore[channel.downcase] ||= Marvin::IRC::Server::Channel.new(channel)) if chan.join(self) - rpl :TOPIC, channel, ":#{chan.topic.blank? ? "There is no topic" : nchan.topic}" + rpl :TOPIC, channel, ":#{chan.topic.blank? ? "There is no topic" : chan.topic}" rpl :NAMREPLY, "=", channel, ":#{chan.members.map { |m| m.nick }.join(" ")}" rpl :ENDOFNAMES, channel, ":End of /NAMES list." @channels << chan else logger.debug "Couldn't join channel '#{channel}'" @@ -121,18 +123,18 @@ return if @prefix.blank? || opts[:target].blank? c = Marvin::IRC::Server::ChannelStore[opts[:target].downcase] return if c.blank? if !@channels.include?(c) err :NOTONCHANNEL, opts[:target], ":Not a member of that channel" - elsif opts[:message].nil? + elsif opts[:topic].blank? t = c.topic if t.blank? rpl :NOTOPIC, c.name, ":No topic is set" else rpl :TOPIC, c.name, ":#{t}" end else - c.topic self, opts[:message].strip + c.topic self, opts[:topic].strip end end end \ No newline at end of file