Add in color url support in text for tweets.

This commit is contained in:
spline 2012-10-26 06:52:35 -04:00
parent ab48ce05df
commit ea5b33638a
1 changed files with 3 additions and 6 deletions

View File

@ -267,11 +267,7 @@ class Tweety(callbacks.Plugin):
# twitter = OAuthApi(self.registryValue('consumerKey'), self.registryValue('consumerSecret'), self.registryValue('accessKey'), self.registryValue('accessSecret'))
def _highlightUrl(self, text):
URL_REGEX = compile_regex('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+')
def _encode(string):
def _encode(self, string):
try:
return string.encode(stdout.encoding, 'replace')
except AttributeError:
@ -356,8 +352,9 @@ class Tweety(callbacks.Plugin):
# add in the end with the text + tape
if outputColorTweets:
text = re.sub(r'(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)', ircutils.mircColor(r'\1', 'red'), text) # color urls.
ret += ": {0} ({1})".format(text, ircutils.mircColor(time, 'yellow'))
else:
else:
ret += ": {0} ({1})".format(text, ircutils.bold(time))
if self.registryValue('addShortUrl', msg.args[0]):