Permalink
Browse files

update net_ease lib because of net_ease modified it's protocol

  • Loading branch information...
1 parent 7af4010 commit 0cdb8a211a2134ad2cdb8731e273749ab41dc9c8 @kamechb committed Mar 2, 2011
Showing with 20 additions and 6 deletions.
  1. +1 −1 Rakefile
  2. +12 −1 examples/grab_contacts.rb
  3. +1 −1 lib/contacts/base.rb
  4. +4 −1 lib/contacts/net_ease.rb
  5. +2 −2 lib/contacts/sina.rb
View
@@ -71,7 +71,7 @@ spec = Gem::Specification.new do |s|
#### Author and project details.
- s.authors = ["Lucas Carlson", "Wolfer"]
+ s.authors = ["Lucas Carlson", "kame"]
s.email = ["lucas@rufy.com,","kamechb@gmail.com"]
s.homepage = "http://rubyforge.org/projects/contacts"
end
View
@@ -2,11 +2,22 @@
login = ARGV[0]
password = ARGV[1]
-
+#login is your email
Contacts::Gmail.new(login, password).contacts
Contacts.new(:gmail, login, password).contacts
Contacts.new("gmail", login, password).contacts
Contacts.guess(login, password).contacts
+
+Contacts.new(:yahoo,login,password).contacts
+
+Contacts.new(:hotmail,login,password).contacts
+
+#net_ease support 163.com, 126.com, yeah.net
+Contacts.new(:net_ease,login,password).contacts
+
+Contacts.new(:sina,login,password).contacts
+
+Contacts.new(:sohu,login,password).contacts
View
@@ -9,7 +9,7 @@
class Contacts
TYPES = {}
- VERSION = "1.2.4"
+ VERSION = "1.2.6"
class Base
def initialize(login, password, options={})
View
@@ -102,7 +102,10 @@ def enter_mail_server
#get mail server and sid
enter_mail_url = ENTER_MAIL_URL[@mail_type] % @login
data, resp, cookies, forward = get(enter_mail_url,@cookies)
- unless data.match(/<a.*?(http.*?)main.jsp\?sid=(.*?)\">/)
+ location = resp['Location']
+ data_reg = /<a.*?(http.*?)main.jsp\?sid=(.*?)\">/
+ location_reg = /(http.*?)main.jsp\?sid=(.*)/
+ unless data.match(data_reg) || location.match(location_reg)
raise ConnectionError, self.class.const_get(:PROTOCOL_ERROR)
end
@cookies = cookies
View
@@ -49,10 +49,10 @@ def get_mail_type(username)
end
def parse(data)
- data =~ /conf="(\{.*?\})"/m
+ data =~ /conf.*?contacts:.*?(\{.*?\}),\s*groups:/m
contacts = $1.gsub("&quot;",'')
contacts = ActiveSupport::JSON.decode(contacts)
- contacts['contacts']['contact'].map{|contactor|
+ contacts['contact'].map{|contactor|
[contactor['name'],contactor['email']]
}
end

0 comments on commit 0cdb8a2

Please sign in to comment.