url image preview. remove qip bbcode in the url
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
[info]
|
[info]
|
||||||
name: Url image preview
|
name: Url image preview
|
||||||
short_name: url_image_preview
|
short_name: url_image_preview
|
||||||
version: 0.4
|
version: 0.5
|
||||||
description: Url image preview in chatbox.
|
description: Url image preview in chatbox.
|
||||||
Based on patch in ticket #5300:
|
Based on patch in ticket #5300:
|
||||||
http://trac.gajim.org/attachment/ticket/5300.
|
http://trac.gajim.org/attachment/ticket/5300.
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ class Base(object):
|
|||||||
def print_special_text(self, special_text, other_tags, graphics=True):
|
def print_special_text(self, special_text, other_tags, graphics=True):
|
||||||
if not gajim.interface.basic_pattern_re.match(special_text):
|
if not gajim.interface.basic_pattern_re.match(special_text):
|
||||||
return
|
return
|
||||||
|
# remove qip bbcode
|
||||||
|
special_text = special_text.rsplit('[/img]')[0]
|
||||||
|
|
||||||
name, extension = os.path.splitext(special_text)
|
name, extension = os.path.splitext(special_text)
|
||||||
if extension.lower() not in EXTENSIONS:
|
if extension.lower() not in EXTENSIONS:
|
||||||
@@ -83,7 +85,7 @@ class Base(object):
|
|||||||
mark = buffer_.create_mark(None, iter_, True)
|
mark = buffer_.create_mark(None, iter_, True)
|
||||||
# start downloading image
|
# start downloading image
|
||||||
gajim.thread_interface(helpers.download_image, [
|
gajim.thread_interface(helpers.download_image, [
|
||||||
self.textview.account, {'src': special_text}], self._update_img, [mark])
|
self.textview.account, {'src': special_text}],self._update_img, [mark])
|
||||||
|
|
||||||
def _update_img(self, (mem, alt), mark):
|
def _update_img(self, (mem, alt), mark):
|
||||||
if mem:
|
if mem:
|
||||||
|
|||||||
Reference in New Issue
Block a user