+ def to_s
+ "#%d (%d): %s" % [self.num, self.vote, self.irc_text]
+ end
+
+ private
+ def mk_irc_text
+ cur_nick = nil
+ last_nick = nil
+ text = String.new
+ @text.each_line { |l|
+ debug "line: #{l.inspect}"
+ cur_nick = l.match(/^\s*(<.*?>|\(.*?\)|.*?:)\s/)[1] rescue nil
+ debug "nick: #{cur_nick.inspect}; last: #{last_nick.inspect}"
+ if cur_nick and cur_nick == last_nick
+ text << l.sub(cur_nick,"")
+ else
+ last_nick = cur_nick.dup if cur_nick
+ text << l
+ end
+ }
+ debug text
+ # TODO: the gsub of br tags to | should be an ircify_html option
+ text.gsub(/(?:<br \/>\s*)+/, ' | ').ircify_html
+ end
+