lib/blackbook/importer/yahoo.rb in bcardarella-blackbook-1.0.10 vs lib/blackbook/importer/yahoo.rb in bcardarella-blackbook-1.0.11
- old
+ new
@@ -8,11 +8,11 @@
##
# Matches this importer to an user's name/address
def =~(options = {})
- options && options[:username] =~ /@yahoo.com$/i ? true : false
+ options && options[:username] =~ /@yahoo.co(m|\.uk)$/i ? true : false
end
##
# login for Yahoo!
@@ -49,10 +49,10 @@
csv = agent.submit(form, form.buttons[2]) # third button is Yahoo-format CSV
contact_rows = FasterCSV.parse(csv.body)
labels = contact_rows.shift # TODO: Actually use the labels to find the indexes of the data we want
contact_rows.collect do |row|
- next if !row[7].empty? && options[:username] =~ /^#{row[7]}/ # Don't collect self
+ next if !row[7].empty? && options[:username] =~ /^#{Regexp.escape(row[7])}/ # Don't collect self
{
:name => "#{row[0]} #{row[2]}".to_s,
:email => (row[4] || "#{row[7]}@yahoo.com") # email is a field in the data, but will be blank for Yahoo users so we create their email address
}
end