Merge lp:~roignac/gwibber/Bug548524 into lp:gwibber

Proposed by Vadim Rutkovsky
Status: Rejected
Rejected by: Robert Bruce Park
Proposed branch: lp:~roignac/gwibber/Bug548524
Merge into: lp:gwibber
Diff against target: 48 lines (+5/-3)
3 files modified
gwibber/actions.py (+2/-3)
gwibber/microblog/twitter.py (+2/-0)
gwibber/microblog/util/__init__.py (+1/-0)
To merge this branch: bzr merge lp:~roignac/gwibber/Bug548524
Reviewer Review Type Date Requested Status
Robert Bruce Park Disapprove
gwibber-committers Pending
Review via email: mp+33991@code.launchpad.net

Description of the change

Fixes LP:548524 - when sending message using twitter, group tags are also replaced with hashtags. Also, moved PARSE_GROUP variable to util module.

To post a comment you must log in.
Revision history for this message
Robert Bruce Park (robru) wrote :

Thanks for taking the time to submit this patch, unfortunately Gwibber has gone through extensive changes recently and your patch no longer applies to the latest codebase.

Fortunately, the bug you were attempting to fix is no longer present in the current codebase. The new Twitter plugin does not do any parsing/munging of group or hashtags, so currently if you were to send a group tag to Twitter using Gwibber, Twitter would receive the message as you wrote it.

Please try out the latest Gwibber, I think you'll be quite pleased with what we've accomplished.

review: Disapprove

Unmerged revisions

832. By Vadim Rutkovsky

group tags are replaced with hashtags when message is sent from Twitter

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gwibber/actions.py'
--- gwibber/actions.py 2010-08-26 19:06:44 +0000
+++ gwibber/actions.py 2010-08-28 11:41:05 +0000
@@ -43,7 +43,6 @@
43class retweet(MessageAction):43class retweet(MessageAction):
44 icon = "mail-forward"44 icon = "mail-forward"
45 label = _("R_etweet")45 label = _("R_etweet")
46 PARSE_GROUP = re.compile("\B!([A-Za-z0-9_\-]+|@[A-Za-z0-9_\-]$)")
4746
48 @classmethod47 @classmethod
49 def action(self, w, client, msg):48 def action(self, w, client, msg):
@@ -51,9 +50,9 @@
51 text = RETWEET_FORMATS[client.model.settings["retweet_style"]]50 text = RETWEET_FORMATS[client.model.settings["retweet_style"]]
52 symbol = "RD" if msg["service"] == "identica" else "RT"51 symbol = "RD" if msg["service"] == "identica" else "RT"
53 text = text.format(text=msg["text"], nick=msg["sender"]["nick"], R=symbol)52 text = text.format(text=msg["text"], nick=msg["sender"]["nick"], R=symbol)
54 #replace ! with # if identica service53 #replace ! with # if service is identica
55 if msg["service"] == "identica" and client.model.settings["global_retweet"]:54 if msg["service"] == "identica" and client.model.settings["global_retweet"]:
56 text = self.PARSE_GROUP.sub('#\\1', text)55 text = gwibber.microblog.util.PARSE_GROUP.sub('#\\1', text)
5756
58 if not client.model.settings["global_retweet"]:57 if not client.model.settings["global_retweet"]:
59 client.message_target.set_target(msg, "repost")58 client.message_target.set_target(msg, "repost")
6059
=== modified file 'gwibber/microblog/twitter.py'
--- gwibber/microblog/twitter.py 2010-08-26 19:14:43 +0000
+++ gwibber/microblog/twitter.py 2010-08-28 11:41:05 +0000
@@ -240,6 +240,8 @@
240 return self._get("favorites/create/%s.json" % message["mid"], None, post=True, do=1)240 return self._get("favorites/create/%s.json" % message["mid"], None, post=True, do=1)
241241
242 def send(self, message):242 def send(self, message):
243 # replace identica groups (!) with hashtags if message is sent to twitter
244 message = util.PARSE_GROUP.sub('#\\1', message)
243 return self._get("statuses/update.json", post=True, single=True,245 return self._get("statuses/update.json", post=True, single=True,
244 status=message, source="gwibbernet")246 status=message, source="gwibbernet")
245 247
246248
=== modified file 'gwibber/microblog/util/__init__.py'
--- gwibber/microblog/util/__init__.py 2010-08-22 18:30:36 +0000
+++ gwibber/microblog/util/__init__.py 2010-08-28 11:41:05 +0000
@@ -30,6 +30,7 @@
30PARSE_NICK = re.compile("\B@([A-Za-z0-9_]+|@[A-Za-z0-9_]$)")30PARSE_NICK = re.compile("\B@([A-Za-z0-9_]+|@[A-Za-z0-9_]$)")
31PARSE_HASH = re.compile("\B#([A-Za-z0-9_\-]+|@[A-Za-z0-9_\-]$)")31PARSE_HASH = re.compile("\B#([A-Za-z0-9_\-]+|@[A-Za-z0-9_\-]$)")
32PARSE_URLS = re.compile(r"<[^<]*?/?>") 32PARSE_URLS = re.compile(r"<[^<]*?/?>")
33PARSE_GROUP = re.compile("\B!([A-Za-z0-9_\-]+|@[A-Za-z0-9_\-]$)")
3334
34def strip_urls(text):35def strip_urls(text):
35 return PARSE_URLS.sub("", text)36 return PARSE_URLS.sub("", text)