Commit 647f65c5 authored by crazycatdevs's avatar crazycatdevs Committed by Sébastien Helleu

shortenurl.py 0.6.6: fix encoding bug, fix show_own when user is op, halfop or voice

parent eddb7685
......@@ -14,6 +14,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# History
# 2019-10-10, CrazyCat <[email protected]>
# version 0.6.6: fix trouble of "b'"
# : fix short_own=off bug when user is @,% or +
# 2019-10-01, Cian Butler <[email protected]>
# version 0.6.5: make script compatible with Python 3
# 2019-02-20, Jochen Saalfeld <[email protected]>
......@@ -57,7 +60,7 @@ except ImportError:
SCRIPT_NAME = "shortenurl"
SCRIPT_AUTHOR = "John Anderson <[email protected]>"
SCRIPT_VERSION = "0.6.5"
SCRIPT_VERSION = "0.6.6"
SCRIPT_LICENSE = "GPL3"
SCRIPT_DESC = "Shorten long incoming and outgoing URLs"
......@@ -108,6 +111,7 @@ def notify(data, buf, date, tags, displayed, hilight, prefix, msg):
reset = weechat.color('reset')
my_nick = weechat.buffer_get_string(buf, 'localvar_nick')
prefix = re.sub(r'^[@%+~]', r'', prefix)
if prefix != my_nick:
urls = find_and_process_urls(msg)
......@@ -161,7 +165,7 @@ def get_shortened_url(url):
try:
opener = build_opener()
opener.addheaders = [('User-Agent', 'weechat')]
return opener.open(url).read()
return opener.open(url).read().decode('utf-8')
except:
return url
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment