Merge lp:~colindean/gwibber/linkify-stocks-lp364303 into lp:gwibber/1.2

Proposed by Colin Dean
Status: Rejected
Rejected by: Ken VanDine
Proposed branch: lp:~colindean/gwibber/linkify-stocks-lp364303
Merge into: lp:gwibber/1.2
Diff against target: None lines
To merge this branch: bzr merge lp:~colindean/gwibber/linkify-stocks-lp364303
Reviewer Review Type Date Requested Status
Ken VanDine Disapprove
Review via email: mp+10339@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Colin Dean (colindean) wrote :

This branch adds linkification of stock tickers prefixed with '$' to jaiku, qaiku, twitter, identica, laconica and facebook. Clicking on a linked ticker will open Google Finance.

It addresses lp #364303.

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Sorry this took so long to get reviewed, this no longer applies to trunk.

Thanks for your submission.

review: Disapprove

Unmerged revisions

359. By Colin Dean

lp #364303

adds stock ticker linkification support to facebook, identica, jaiku, laconica, qaiku, and twitter. jaiku and qaiku are untested, laconica is tested only by proxy via identica

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gwibber/client.py'
2--- gwibber/client.py 2009-08-17 20:43:12 +0000
3+++ gwibber/client.py 2009-08-18 19:08:36 +0000
4@@ -635,6 +635,10 @@
5 else:
6 webbrowser.open (msg.url)
7 return True
8+ elif uri.startswith("gwibber:ticker"):
9+ query = uri.split("/")[-1]
10+ webbrowser.open("http://www.google.com/finance?q=%s" % query)
11+ return True
12 else: return False
13
14 def on_input_context_menu(self, obj, menu):
15
16=== modified file 'gwibber/microblog/facebook.py'
17--- gwibber/microblog/facebook.py 2009-03-10 13:03:17 +0000
18+++ gwibber/microblog/facebook.py 2009-08-18 19:08:36 +0000
19@@ -26,6 +26,7 @@
20 APP_KEY = "71b85c6d8cb5bbb9f1a3f8bbdcdd4b05"
21 SECRET_KEY = "41e43c90f429a21e55c7ff67aa0dc201"
22 LINK_PARSE = re.compile("<a[^>]+href=\"(https?://[^\"]+)\">[^<]+</a>")
23+TICKER_PARSE = re.compile("\B\$([A-Za-z]+)")
24
25 def sanitize_text(t):
26 return LINK_PARSE.sub("\\1", t.strip()) #.replace("<", "&lt;").replace(">", "&gt;").replace("&", "&amp;")
27@@ -49,6 +50,7 @@
28 self.time = mx.DateTime.DateTimeFrom(data['status']['time']).gmtime()
29
30 self.text = sanitize_text(data['status']['message'])
31+ self.text = TICKER_PARSE.sub('$<a class="inlineticker" href="gwibber:ticker/\\1">\\1</a>', self.text)
32
33 if self.text.startswith(self.sender):
34 self.text = self.text[len(self.sender)+1:]
35@@ -57,7 +59,7 @@
36 if data['pic_square']:
37 self.image = data['pic_square']
38 else:
39- self.image = "http://digg.com/img/udl.png"
40+ self.image = "http://digg.com/img/udl.png" #should this be here? looks like it's meant to be in digg
41 except Exception:
42 from traceback import format_exc
43 print(format_exc())
44
45=== modified file 'gwibber/microblog/identica.py'
46--- gwibber/microblog/identica.py 2009-06-21 01:17:53 +0000
47+++ gwibber/microblog/identica.py 2009-08-18 19:08:36 +0000
48@@ -45,6 +45,7 @@
49 NICK_PARSE = re.compile("\B@([A-Za-z0-9_]+|@[A-Za-z0-9_]$)")
50 HASH_PARSE = re.compile("\B#([A-Za-z0-9_\-]+|@[A-Za-z0-9_\-]$)")
51 GROUP_PARSE = re.compile("\B!([A-Za-z0-9_\-]+|![A-Za-z0-9_\-]$)")
52+TICKER_PARSE = re.compile("\B\$([A-Za-z]+)")
53
54 def _posticon(self, a): self._getContext()["laconica_posticon"] = a["rdf:resource"]
55 def _has_creator(self, a): self._getContext()["sioc_has_creator"] = a["rdf:resource"]
56@@ -90,8 +91,9 @@
57 self.html_string = '<span class="text">%s</span>' % \
58 HASH_PARSE.sub('#<a class="inlinehash" href="gwibber:tag/\\1">\\1</a>',
59 NICK_PARSE.sub('@<a class="inlinenick" href="gwibber:user/'+self.account.id+'/\\1">\\1</a>',
60+ TICKER_PARSE.sub('$<a class="inlineticker" href="gwibber:ticker/\\1">\\1</a>',
61 GROUP_PARSE.sub('!<a class="inlinegroup" href="gwibber:group/\\1">\\1</a>',
62- support.linkify(self.text))))
63+ support.linkify(self.text)))))
64 self.is_reply = re.compile("@%s[\W]+|@%s$" % (self.username, self.username)).search(self.text)
65
66 class SearchResult:
67@@ -114,8 +116,9 @@
68 self.html_string = '<span class="text">%s</span>' % \
69 HASH_PARSE.sub('#<a class="inlinehash" href="gwibber:tag/\\1">\\1</a>',
70 NICK_PARSE.sub('@<a class="inlinenick" href="gwibber:user/'+self.account.id+'/\\1">\\1</a>',
71+ TICKER_PARSE.sub('$<a class="inlineticker" href="gwibber:ticker/\\1">\\1</a>',
72 GROUP_PARSE.sub('!<a class="inlinegroup" href="gwibber:group/\\1">\\1</a>',
73- support.linkify(self.text))))
74+ support.linkify(self.text)))))
75 self.is_reply = re.compile("@%s[\W]+|@%s$" % (self.username, self.username)).search(self.text)
76
77 class Client:
78
79=== modified file 'gwibber/microblog/jaiku.py'
80--- gwibber/microblog/jaiku.py 2009-05-27 18:01:44 +0000
81+++ gwibber/microblog/jaiku.py 2009-08-18 19:08:36 +0000
82@@ -33,6 +33,7 @@
83
84 NONCE_PARSE = re.compile('.*_nonce" value="([^"]+)".*', re.M | re.S)
85 LINK_MARKUP_PARSE = re.compile("\[([^\]]+)\]\(([^)]+)\)")
86+TICKER_PARSE = re.compile("\B\$([A-Za-z]+)")
87
88 class Message:
89 def __init__(self, client, data):
90@@ -52,6 +53,7 @@
91 self.text = ""
92 if "title" in data:
93 self.text = data["title"]
94+ self.text = TICKER_PARSE.sub('$<a class="inlineticker" href="gwibber:ticker/\\1">\\1</a>', self.text)
95 #self.html_string = LINK_MARKUP_PARSE.sub('<a href="\\2">\\1</a>', self.text.replace(
96 # "&", "&amp;").replace("<", "&lt;").replace(">", "&gt;"))
97 self.image = data["user"]["avatar"]
98@@ -72,6 +74,7 @@
99 self.is_comment = True
100
101 self.text = data["content"]
102+ self.text = TICKER_PARSE.sub('$<a class="inlineticker" href="gwibber:ticker/\\1">\\1</a>', self.text)
103 #self.html_string = support.LINK_PARSE.sub('<a href="\\1">\\1</a>', LINK_MARKUP_PARSE.sub('<a href="\\2">\\1</a>', self.text.replace(
104 # "&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")))
105
106
107=== modified file 'gwibber/microblog/laconica.py'
108--- gwibber/microblog/laconica.py 2009-06-21 00:04:28 +0000
109+++ gwibber/microblog/laconica.py 2009-08-18 19:08:36 +0000
110@@ -45,6 +45,7 @@
111 NICK_PARSE = re.compile("\B@([A-Za-z0-9_]+|@[A-Za-z0-9_]$)")
112 HASH_PARSE = re.compile("\B#([A-Za-z0-9_\-]+|@[A-Za-z0-9_\-]$)")
113 GROUP_PARSE = re.compile("\B!([A-Za-z0-9_\-]+|![A-Za-z0-9_\-]$)")
114+TICKER_PARSE = re.compile("\B\$([A-Za-z]+)")
115
116 def _posticon(self, a): self._getContext()["laconica_posticon"] = a["rdf:resource"]
117 def _has_creator(self, a): self._getContext()["sioc_has_creator"] = a["rdf:resource"]
118@@ -89,8 +90,9 @@
119 self.html_string = '<span class="text">%s</span>' % \
120 HASH_PARSE.sub('#<a class="inlinehash" href="gwibber:tag/\\1">\\1</a>',
121 NICK_PARSE.sub('@<a class="inlinenick" href="gwibber:user/'+self.account.id+'/\\1">\\1</a>',
122+ TICKER_PARSE.sub('$<a class="inlineticker" href="gwibber:ticker/\\1">\\1</a>',
123 GROUP_PARSE.sub('!<a class="inlinegroup" href="gwibber:group/\\1">\\1</a>',
124- support.linkify(self.text))))
125+ support.linkify(self.text)))))
126 self.is_reply = re.compile("@%s[\W]+|@%s$" % (self.username, self.username)).search(self.text)
127
128 class SearchResult:
129@@ -113,8 +115,9 @@
130 self.html_string = '<span class="text">%s</span>' % \
131 HASH_PARSE.sub('#<a class="inlinehash" href="gwibber:tag/\\1">\\1</a>',
132 NICK_PARSE.sub('@<a class="inlinenick" href="http://%s/\\1">\\1</a>' % self.account["domain"],
133+ TICKER_PARSE.sub('$<a class="inlineticker" href="gwibber:ticker/\\1">\\1</a>',
134 GROUP_PARSE.sub('!<a class="inlinegroup" href="gwibber:group/\\1">\\1</a>',
135- support.linkify(self.text))))
136+ support.linkify(self.text)))))
137 self.is_reply = re.compile("@%s[\W]+|@%s$" % (self.username, self.username)).search(self.text)
138
139 class Client:
140
141=== modified file 'gwibber/microblog/qaiku.py'
142--- gwibber/microblog/qaiku.py 2009-08-16 04:24:35 +0000
143+++ gwibber/microblog/qaiku.py 2009-08-18 19:08:36 +0000
144@@ -39,6 +39,7 @@
145
146 NICK_PARSE = re.compile("\B@([A-Za-z0-9_]+|@[A-Za-z0-9_]$)")
147 HASH_PARSE = re.compile("\B#([A-Za-z0-9_\-]+|@[A-Za-z0-9_\-]$)")
148+TICKER_PARSE = re.compile("\B\$([A-Za-z]+)")
149
150 class Message:
151 def __init__(self, client, data):
152@@ -69,8 +70,9 @@
153 self.text = data["text"]
154 self.html_string = '<span class="text">%s</span>' % \
155 HASH_PARSE.sub('#<a class="inlinehash" href="gwibber:tag/\\1">\\1</a>',
156+ TICKER_PARSE.sub('$<a class="inlineticker" href="gwibber:ticker/\\1">\\1</a>',
157 NICK_PARSE.sub('@<a class="inlinenick" href="gwibber:user/'+self.account.id+'/\\1">\\1</a>',
158- support.linkify(self.text)))
159+ support.linkify(self.text))))
160 self.is_reply = re.compile("@%s[\W]+|@%s$" % (self.username, self.username)).search(self.text)
161 self.can_thread = True
162
163
164=== modified file 'gwibber/microblog/twitter.py'
165--- gwibber/microblog/twitter.py 2009-06-21 01:17:53 +0000
166+++ gwibber/microblog/twitter.py 2009-08-18 19:08:36 +0000
167@@ -47,6 +47,7 @@
168
169 NICK_PARSE = re.compile("\B@([A-Za-z0-9_]+|@[A-Za-z0-9_]$)")
170 HASH_PARSE = re.compile("\B#([A-Za-z0-9_\-]+|@[A-Za-z0-9_\-]$)")
171+TICKER_PARSE = re.compile("\B\$([A-Za-z]+)")
172
173 class Message:
174 def __init__(self, client, data):
175@@ -88,9 +89,11 @@
176 if "text" in data:
177 self.text = data["text"]
178 self.html_string = '<span class="text">%s</span>' % \
179- HASH_PARSE.sub('#<a class="inlinehash" href="gwibber:tag/\\1">\\1</a>',
180- NICK_PARSE.sub('@<a class="inlinenick" href="gwibber:user/'+self.account.id+'/\\1">\\1</a>',
181- support.linkify(self.text)))
182+ HASH_PARSE.sub('#<a class="inlinehash" href="gwibber:tag/\\1">\\1</a>', \
183+ TICKER_PARSE.sub('$<a class="inlineticker" href="gwibber:ticker/\\1">\\1</a>',\
184+ NICK_PARSE.sub('@<a class="inlinenick" href="gwibber:user/'+self.account.id+'/\\1">\\1</a>', \
185+ support.linkify(self.text))))
186+
187 self.is_reply = re.compile("@%s[\W]+|@%s$" % (self.username, self.username)).search(self.text)
188 self.reply_nick = ''
189 self.reply_url = ''
190@@ -135,8 +138,9 @@
191
192 self.html_string = '<span class="text">%s</span>' % \
193 HASH_PARSE.sub('#<a class="inlinehash" href="gwibber:tag/\\1">\\1</a>',
194+ TICKER_PARSE.sub('$<a class="inlineticker" href="gwibber:ticker/\\1">\\1</a>',
195 NICK_PARSE.sub('@<a class="inlinenick" href="gwibber:user/'+self.account.id+'/\\1">\\1</a>',
196- support.linkify(self.text)))
197+ support.linkify(self.text))))
198
199 self.is_reply = re.compile("@%s[\W]+|@%s$" % (self.username, self.username)).search(self.text)
200

Subscribers

People subscribed via source and target branches