diff options
author | kongr45gpen <electrovesta@gmail.com> | 2016-01-21 16:18:46 +0200 |
---|---|---|
committer | kongr45gpen <electrovesta@gmail.com> | 2016-01-21 16:18:46 +0200 |
commit | 5a5e25fdfb6fd7482b52d0232fae974c5e483749 (patch) | |
tree | ba6dfd30bd8e890cf647c0fc2cfd0d20bb3191aa | |
parent | d54c3d33b79094938393e6e995c64f0eda492f9c (diff) | |
download | supybot_github-5a5e25fdfb6fd7482b52d0232fae974c5e483749.tar.gz supybot_github-5a5e25fdfb6fd7482b52d0232fae974c5e483749.tar.bz2 supybot_github-5a5e25fdfb6fd7482b52d0232fae974c5e483749.zip |
Make travis links purple
Closes #7
-rw-r--r-- | local/handler/TravisHandler.py | 2 | ||||
-rw-r--r-- | local/utility.py | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/local/handler/TravisHandler.py b/local/handler/TravisHandler.py index 3648422..05d6c82 100644 --- a/local/handler/TravisHandler.py +++ b/local/handler/TravisHandler.py @@ -9,5 +9,5 @@ def handle(data, theme): commitId = data['commit'], commitMessage = data['message'], commitAuthor = data['author_name'], - buildUrl = data['build_url'] + buildUrl = getShortURL(data['build_url']) ) diff --git a/local/utility.py b/local/utility.py index 9a3520a..3487b06 100644 --- a/local/utility.py +++ b/local/utility.py @@ -76,7 +76,7 @@ def colorAction(action): def getShortURL(longurl): """ Returns a short URL generated by git.io""" - if configValue("shortURL") is False: + if configValue("shortURL") is False or not getShortURL.github.match(longurl): url = longurl else: data = 'url=%s' % (longurl) @@ -84,6 +84,7 @@ def getShortURL(longurl): response = urllib2.urlopen(req) url = response.info().getheader('Location') return ircutils.mircColor(url, "purple") +getShortURL.github = re.compile('^([a-z]*\:\/\/)?([^\/]+.)?github.com') def saveMessages(msgs): """ Saves the last messages so that the plugin can be easily tested """ |