+ def littre(m, params)
+ justcheck = params[:justcheck]
+
+ word = params[:word].to_s.downcase
+ url = @littreurl % CGI.escape(word)
+ xml = nil
+ info = @bot.httputil.get_response(url) rescue nil
+ xml = info.body if info
+ head ||= xml.match(/<div class="entree">(.*?)<\/div>/)[1] rescue nil
+ case xml
+ when nil
+ info = info ? " (#{info.code} - #{info.message})" : ""
+ return false if justcheck
+ m.reply "An error occurred while looking for #{word}#{info}"
+ return
+ when /Erreur : le mot <STRONG>.*?<\/STRONG> n'a pas./
+ return false if justcheck
+ if head
+ m.reply "Nothing found for #{word}, I'll assume you meant #{head}"
+ else
+ m.reply "Nothing found for #{word}"
+ return
+ end
+ end
+ return true if justcheck
+ entete = xml.match(/<div class="entete">(.*?)<\/div>/m)[1] rescue nil
+ m.reply "#{head}: #{url} : #{entete.ircify_html rescue nil}"
+ entries = xml.scan(/<span class="variante">(.*?)<\!--variante-->/m)
+ hits = @bot.config['dict.hits']
+ n = 0
+ entries[0...hits].map { |ar|
+ n += 1
+ m.reply(("#{Bold}#{n}#{Bold} %s" % ar).ircify_html, :overlong => :truncate)
+ }
+ end
+
+ def is_french?(word)
+ return littre(nil, :word => word, :justcheck => true)
+ end
+