Merge lp:~sil/gwibber/conversations into lp:gwibber/1.2

Proposed by Stuart Langridge on 2009-07-29
Status: Merged
Merge reported by: Ken VanDine
Merged at revision: not available
Proposed branch: lp:~sil/gwibber/conversations
Merge into: lp:gwibber/1.2
Diff against target: None lines
To merge this branch: bzr merge lp:~sil/gwibber/conversations
Reviewer Review Type Date Requested Status
gwibber-committers 2009-07-29 Pending
Review via email: mp+9445@code.launchpad.net
To post a comment you must log in.
Stuart Langridge (sil) wrote :

Add conversations support to Twitter messages: choose "view reply thread" to trace the conversation backwards. Doesn't work quite as well as you'd hope because some Twitter clients don't bother to fill in which message this reply was a reply *to*.

lp:~sil/gwibber/conversations updated on 2009-07-29
355. By Stuart Langridge on 2009-07-29

implement conversations for identica

Preview Diff

1=== modified file 'gwibber/microblog/twitter.py'
2--- gwibber/microblog/twitter.py 2009-06-21 01:17:53 +0000
3+++ gwibber/microblog/twitter.py 2009-07-29 19:40:00 +0000
4@@ -37,7 +37,7 @@
5 can.DELETE,
6 can.RETWEET,
7 can.LIKE,
8- #can.THREAD,
9+ can.THREAD,
10 can.THREAD_REPLY,
11 can.SEARCH_URL,
12 can.USER_MESSAGES,
13@@ -74,7 +74,7 @@
14 self.reply_url = None
15 elif "name" in data:
16 user = data
17-
18+
19 self.sender = user["name"]
20 self.sender_nick = user["screen_name"]
21 self.sender_id = user["id"]
22@@ -87,6 +87,7 @@
23
24 if "text" in data:
25 self.text = data["text"]
26+ if self.text.startswith("@"): print data
27 self.html_string = '<span class="text">%s</span>' % \
28 HASH_PARSE.sub('#<a class="inlinehash" href="gwibber:tag/\\1">\\1</a>',
29 NICK_PARSE.sub('@<a class="inlinenick" href="gwibber:user/'+self.account.id+'/\\1">\\1</a>',
30@@ -108,6 +109,8 @@
31 if "in_reply_to_screen_name" in data and "in_reply_to_status_id" in data and data["in_reply_to_status_id"]:
32 self.reply_nick = data["in_reply_to_screen_name"]
33 self.reply_url = "https://twitter.com/%s/statuses/%s" % (self.reply_nick, data["in_reply_to_status_id"])
34+ self.reply_to_id = data["in_reply_to_status_id"]
35+ self.can_thread = True
36 except Exception:
37 from traceback import format_exc
38 print(format_exc())
39@@ -200,6 +203,18 @@
40 return simplejson.loads(self.connect(
41 "https://twitter.com/direct_messages.json"))
42
43+ def get_thread(self, msg):
44+ yield msg
45+ while 1:
46+ if not hasattr(msg, "reply_to_id"):
47+ print "this message doesn't have a reply to id", msg.text
48+ break
49+ # get the next message
50+ next = simplejson.loads(self.connect(
51+ "http://twitter.com/statuses/show/%s.json" % msg.reply_to_id))
52+ msg = Message(self, next)
53+ yield msg
54+
55 def get_search_data(self, query):
56 return simplejson.loads(urllib2.urlopen(
57 urllib2.Request("http://search.twitter.com/search.json",

Subscribers

People subscribed via source and target branches