url image preview. remove qip bbcode in the url

This commit is contained in:
Denis Fomin
2012-06-21 12:24:42 +04:00
parent c2f8dca957
commit d7dc50dab4
2 changed files with 4 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
[info]
name: Url image preview
short_name: url_image_preview
version: 0.4
version: 0.5
description: Url image preview in chatbox.
Based on patch in ticket #5300:
http://trac.gajim.org/attachment/ticket/5300.

View File

@@ -66,6 +66,8 @@ class Base(object):
def print_special_text(self, special_text, other_tags, graphics=True):
if not gajim.interface.basic_pattern_re.match(special_text):
return
# remove qip bbcode
special_text = special_text.rsplit('[/img]')[0]
name, extension = os.path.splitext(special_text)
if extension.lower() not in EXTENSIONS:
@@ -83,7 +85,7 @@ class Base(object):
mark = buffer_.create_mark(None, iter_, True)
# start downloading 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):
if mem: