• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

Commit MetaInfo

Revisãoa5f18f786b3bc3674c51c6b2baf41e2b7e525582 (tree)
Hora2009-09-22 20:32:48
Autorikeji <ikeji@f836...>
Commiterikeji

Mensagem de Log

Add new plugin feed "mail.com".

git-svn-id: http://dev.ikejima.org/src/svn/pragger/trunk@412 f8368ae4-1e99-dc11-9799-0018f35ab5fa

Mudança Sumário

Diff

--- /dev/null
+++ b/plugin/Feed/mailcom.rb
@@ -0,0 +1,48 @@
1+## Get mail lists from http://mail.com
2+
3+begin
4+ require 'rubygems'
5+rescue LoadError
6+end
7+require 'mechanize'
8+
9+def mailcom(config, data)
10+ agent = WWW::Mechanize.new
11+ page = agent.get("http://mail.com")
12+ form = page.forms[1]
13+ form.fields.find{|f| f.name == 'login'}.value = $reg['mailcom']['username']
14+ form.fields.find{|f| f.name == 'password'}.value = $reg['mailcom']['password']
15+ page = agent.submit(form,form.buttons.first)
16+
17+ page = agent.get(page.frames[1].uri)
18+
19+ page = agent.get("http://mail01.mail.com/scripts/mail/mailbox.mail?folder=INBOX")
20+
21+ result = []
22+ page.links.each do|l|
23+ uri = l.uri.to_s rescue ""
24+ if uri =~ /\/scripts\/mail\/read\.mail/
25+ result.push MailComRSSItem.new(l)
26+ end
27+ end
28+ return result
29+end
30+
31+class MailComRSSItem
32+ def initialize (link)
33+ @link = link
34+ end
35+
36+ def title
37+ @link.text
38+ end
39+ def link
40+ "http://mail01.mail.com" + @link.href.sub(/&mprev=.*/,"")
41+ end
42+ def description
43+ @link.text
44+ end
45+ def to_s
46+ @link.text + " \nhttp://mail01.mail.com" + @link.href.sub(/&mprev=.*/,"") + "\n\n\n\n"
47+ end
48+end