GitHub: use TinyURL.com for links to commits.
parent
f10efb31f3
commit
32f1e6da89
|
@ -69,5 +69,9 @@ conf.registerGlobalValue(GitHub, 'announces',
|
|||
registry.String('', _("""You shouldn't edit this configuration
|
||||
variable yourself, unless you know what you do. Use '@Github announce
|
||||
add' or '@Github announce remove' instead.""")))
|
||||
conf.registerGlobalValue(GitHub, 'tiny',
|
||||
registry.String('http://tinyurl.com/api-create.php', _("""The URL
|
||||
used to tinyfy the commit link (must be compatible with TinyURL.com
|
||||
""")))
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||
|
|
|
@ -137,13 +137,17 @@ class GitHub(callbacks.Plugin):
|
|||
class announce(callbacks.Commands):
|
||||
def _createPrivmsg(self, channel, payload, commit):
|
||||
bold = ircutils.bold
|
||||
url = commit['url']
|
||||
data = urllib.urlencode({'url': url})
|
||||
tiny = self.registryValue('tiny', channel)
|
||||
url = urllib.urlopen(tiny, data).read()
|
||||
s = '%s/%s (in %s): %s committed %s %s' % \
|
||||
(payload['repository']['owner']['name'],
|
||||
bold(payload['repository']['name']),
|
||||
bold(payload['ref'].split('/')[-1]),
|
||||
commit['author']['name'],
|
||||
bold(commit['message']),
|
||||
commit['url'][0:-34])
|
||||
url)
|
||||
return ircmsgs.privmsg(channel, s)
|
||||
|
||||
def onPayload(self, payload):
|
||||
|
|
Loading…
Reference in New Issue