gajim.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2026
October
September
August
July
June
May
April
March
February
January
2025
December
November
October
September
August
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
List overview
Download
Commits
November 2011
----- 2026 -----
October 2026
September 2026
August 2026
July 2026
June 2026
May 2026
April 2026
March 2026
February 2026
January 2026
----- 2025 -----
December 2025
November 2025
October 2025
September 2025
August 2025
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
commits@gajim.org
3 participants
55 discussions
Start a n
N
ew thread
gajim: start assigning gc color from the first one. see #7022
by Yann Leboulanger
15 Nov '11
15 Nov '11
changeset d84df889a8e6 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=d84df889a8e6
description: start assigning gc color from the first one. see #7022 diffstat: src/groupchat_control.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 22da5dead579 -r d84df889a8e6 src/groupchat_control.py --- a/src/groupchat_control.py Tue Nov 15 09:48:28 2011 +0100 +++ b/src/groupchat_control.py Tue Nov 15 12:09:39 2011 +0100 @@ -392,7 +392,7 @@ self.tooltip = tooltips.GCTooltip() # nickname coloring - self.gc_count_nicknames_colors = 0 + self.gc_count_nicknames_colors = -1 self.gc_custom_colors = {} self.number_of_colors = len(gajim.config.get('gc_nicknames_colors').\ split(':'))
1
0
0
0
gajim: correctly set the route attribute in BOSH connections.
by Yann Leboulanger
15 Nov '11
15 Nov '11
changeset 22da5dead579 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=22da5dead579
description: correctly set the route attribute in BOSH connections. diffstat: src/common/xmpp/bosh.py | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diffs (28 lines): diff -r 7d10624cd502 -r 22da5dead579 src/common/xmpp/bosh.py --- a/src/common/xmpp/bosh.py Mon Nov 14 23:23:40 2011 +0100 +++ b/src/common/xmpp/bosh.py Tue Nov 15 09:48:28 2011 +0100 @@ -413,15 +413,15 @@ 'xmlns:xmpp': 'urn:xmpp:xbosh'}) else: t = BOSHBody( - attrs={ 'content': self.bosh_content, - 'hold': str(self.bosh_hold), - 'route': '%s:%s' % (self.route_host, self.route_port), - 'to': self.bosh_to, - 'wait': str(self.bosh_wait), - 'xml:lang': self.bosh_xml_lang, - 'xmpp:version': '1.0', - 'ver': '1.6', - 'xmlns:xmpp': 'urn:xmpp:xbosh'}) + attrs={ 'content': self.bosh_content, + 'hold': str(self.bosh_hold), + 'route': 'xmpp:%s:%s' % (self.route_host, self.route_port), + 'to': self.bosh_to, + 'wait': str(self.bosh_wait), + 'xml:lang': self.bosh_xml_lang, + 'xmpp:version': '1.0', + 'ver': '1.6', + 'xmlns:xmpp': 'urn:xmpp:xbosh'}) self.send_BOSH((t, True)) def start_disconnect(self):
1
0
0
0
gajim: move functions to download an image from htmltextview.py ...
by Yann Leboulanger
14 Nov '11
14 Nov '11
changeset 7d10624cd502 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=7d10624cd502
description: move functions to download an image from htmltextview.py to helpers.py diffstat: src/common/helpers.py | 119 ++++++++++++++++++++++++++++++++++++++++++++++++- src/htmltextview.py | 122 +------------------------------------------------ 2 files changed, 122 insertions(+), 119 deletions(-) diffs (truncated from 310 to 300 lines): diff -r 01a491f62e59 -r 7d10624cd502 src/common/helpers.py --- a/src/common/helpers.py Mon Nov 14 18:44:17 2011 +0100 +++ b/src/common/helpers.py Mon Nov 14 23:23:40 2011 +0100 @@ -35,6 +35,7 @@ import os import subprocess import urllib +import urllib2 import webbrowser import errno import select @@ -42,6 +43,8 @@ import hashlib import shlex import caps_cache +import socket +import time from encodings.punycode import punycode_encode from string import Template @@ -58,6 +61,9 @@ except Exception: pass +import logging +log = logging.getLogger('gajim.c.helpers') + special_groups = (_('Transports'), _('Not in Roster'), _('Observers'), _('Groupchats')) class InvalidFormat(Exception): @@ -620,6 +626,9 @@ # import gajim only when needed (after decode_string is defined) see #4764 import gajim +if gajim.HAVE_PYCURL: + import pycurl + from cStringIO import StringIO def convert_bytes(string): suffix = '' @@ -1425,4 +1434,112 @@ proxyptr = gajim.config.get_per('proxies', p) for key in proxyptr.keys(): proxy[key] = proxyptr[key][1] - return proxy \ No newline at end of file + return proxy + +def _get_img_direct(attrs): + """ + Download an image. This function should be launched in a separated thread. + """ + mem, alt = '', '' + # Wait maximum 5s for connection + socket.setdefaulttimeout(5) + try: + req = urllib2.Request(attrs['src']) + req.add_header('User-Agent', 'Gajim ' + gajim.version) + f = urllib2.urlopen(req) + except Exception, ex: + log.debug('Error loading image %s ' % attrs['src'] + str(ex)) + pixbuf = None + alt = attrs.get('alt', 'Broken image') + else: + # Wait 0.5s between each byte + try: + f.fp._sock.fp._sock.settimeout(0.5) + except Exception: + pass + # Max image size = 2 MB (to try to prevent DoS) + deadline = time.time() + 3 + while True: + if time.time() > deadline: + log.debug('Timeout loading image %s ' % attrs['src'] + str(ex)) + mem = '' + alt = attrs.get('alt', '') + if alt: + alt += '\n' + alt += _('Timeout loading image') + break + try: + temp = f.read(100) + except socket.timeout, ex: + log.debug('Timeout loading image %s ' % attrs['src'] + str(ex)) + alt = attrs.get('alt', '') + if alt: + alt += '\n' + alt += _('Timeout loading image') + break + if temp: + mem += temp + else: + break + if len(mem) > 2*1024*1024: + alt = attrs.get('alt', '') + if alt: + alt += '\n' + alt += _('Image is too big') + break + return (mem, alt) + +def _get_img_proxy(attrs, proxy): + """ + Download an image through a proxy. This function should be launched in a + separated thread. + """ + if not gajim.HAVE_PYCURL: + return '', _('PyCURL is not installed') + mem, alt = '', '' + try: + b = StringIO() + c = pycurl.Curl() + c.setopt(pycurl.URL, attrs['src'].encode('utf-8')) + c.setopt(pycurl.FOLLOWLOCATION, 1) + c.setopt(pycurl.CONNECTTIMEOUT, 5) + c.setopt(pycurl.TIMEOUT, 10) + c.setopt(pycurl.MAXFILESIZE, 2000000) + c.setopt(pycurl.WRITEFUNCTION, b.write) + c.setopt(pycurl.USERAGENT, 'Gajim ' + gajim.version) + # set proxy + c.setopt(pycurl.PROXY, proxy['host'].encode('utf-8')) + c.setopt(pycurl.PROXYPORT, proxy['port']) + if proxy['useauth']: + c.setopt(pycurl.PROXYUSERPWD, proxy['user'].encode('utf-8')\ + + ':' + proxy['pass'].encode('utf-8')) + c.setopt(pycurl.PROXYAUTH, pycurl.HTTPAUTH_ANY) + if proxy['type'] == 'http': + c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP) + elif proxy['type'] == 'socks5': + c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5) + x = c.perform() + c.close() + t = b.getvalue() + return (t, attrs.get('alt', '')) + except pycurl.error, ex: + alt = attrs.get('alt', '') + if alt: + alt += '\n' + if ex[0] == pycurl.E_FILESIZE_EXCEEDED: + alt += _('Image is too big') + elif ex[0] == pycurl.E_OPERATION_TIMEOUTED: + alt += _('Timeout loading image') + else: + alt += _('Error loading image') + except Exception, ex: + log.debug('Error loading image %s ' % attrs['src'] + str(ex)) + pixbuf = None + alt = attrs.get('alt', 'Broken image') + return ('', alt) + +def download_image(account, attrs): + proxy = get_proxy_info(account) + if proxy and proxy['type'] in ('http', 'socks5'): + return _get_img_proxy(attrs, proxy) + return _get_img_direct(attrs) \ No newline at end of file diff -r 01a491f62e59 -r 7d10624cd502 src/htmltextview.py --- a/src/htmltextview.py Mon Nov 14 18:44:17 2011 +0100 +++ b/src/htmltextview.py Mon Nov 14 23:23:40 2011 +0100 @@ -41,8 +41,6 @@ import xml.sax, xml.sax.handler import re from cStringIO import StringIO -import socket -import time import urllib2 import operator @@ -56,9 +54,6 @@ from gtkgui_helpers import get_icon_pixmap from common import helpers -if gajim.HAVE_PYCURL: - import pycurl - import tooltips import logging log = logging.getLogger('gajim.htmlview') @@ -494,118 +489,8 @@ tag.title = title return tag - def _get_img_direct(self, attrs): - """ - Download an image. This function is launched in a separate thread. - """ - mem, alt = '', '' - # Wait maximum 5s for connection - socket.setdefaulttimeout(5) - try: - req = urllib2.Request(attrs['src']) - req.add_header('User-Agent', 'Gajim ' + gajim.version) - f = urllib2.urlopen(req) - except Exception, ex: - log.debug('Error loading image %s ' % attrs['src'] + str(ex)) - pixbuf = None - alt = attrs.get('alt', 'Broken image') - else: - # Wait 0.5s between each byte - try: - f.fp._sock.fp._sock.settimeout(0.5) - except Exception: - pass - # Max image size = 2 MB (to try to prevent DoS) - deadline = time.time() + 3 - while True: - if time.time() > deadline: - log.debug(str('Timeout loading image %s ' % \ - attrs['src'] + ex)) - mem = '' - alt = attrs.get('alt', '') - if alt: - alt += '\n' - alt += _('Timeout loading image') - break - try: - temp = f.read(100) - except socket.timeout, ex: - log.debug('Timeout loading image %s ' % \ - attrs['src'] + str(ex)) - alt = attrs.get('alt', '') - if alt: - alt += '\n' - alt += _('Timeout loading image') - break - if temp: - mem += temp - else: - break - if len(mem) > 2*1024*1024: - alt = attrs.get('alt', '') - if alt: - alt += '\n' - alt += _('Image is too big') - break - return (mem, alt) - - def _get_img_proxy(self, attrs, proxy): - """ - Download an image through a proxy. This function is launched in a - separate thread. - """ - if not gajim.HAVE_PYCURL: - return '', _('PyCURL is not installed') - mem, alt = '', '' - try: - b = StringIO() - c = pycurl.Curl() - c.setopt(pycurl.URL, attrs['src'].encode('utf-8')) - c.setopt(pycurl.FOLLOWLOCATION, 1) - c.setopt(pycurl.CONNECTTIMEOUT, 5) - c.setopt(pycurl.TIMEOUT, 10) - c.setopt(pycurl.MAXFILESIZE, 2000000) - c.setopt(pycurl.WRITEFUNCTION, b.write) - c.setopt(pycurl.USERAGENT, 'Gajim ' + gajim.version) - # set proxy - c.setopt(pycurl.PROXY, proxy['host'].encode('utf-8')) - c.setopt(pycurl.PROXYPORT, proxy['port']) - if proxy['useauth']: - c.setopt(pycurl.PROXYUSERPWD, proxy['user'].encode('utf-8')\ - + ':' + proxy['pass'].encode('utf-8')) - c.setopt(pycurl.PROXYAUTH, pycurl.HTTPAUTH_ANY) - if proxy['type'] == 'http': - c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP) - elif proxy['type'] == 'socks5': - c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5) - x = c.perform() - c.close() - t = b.getvalue() - return (t, attrs.get('alt', '')) - except pycurl.error, ex: - alt = attrs.get('alt', '') - if alt: - alt += '\n' - if ex[0] == pycurl.E_FILESIZE_EXCEEDED: - alt += _('Image is too big') - elif ex[0] == pycurl.E_OPERATION_TIMEOUTED: - alt += _('Timeout loading image') - else: - alt += _('Error loading image') - except Exception, ex: - log.debug('Error loading image %s ' % attrs['src'] + str(ex)) - pixbuf = None - alt = attrs.get('alt', 'Broken image') - return ('', alt) - - def _get_img(self, attrs): - proxy = helpers.get_proxy_info(self.conv_textview.account) - if proxy and proxy['type'] in ('http', 'socks5'): - return self._get_img_proxy(attrs, proxy) - return self._get_img_direct(attrs) - def _update_img(self, (mem, alt), attrs, img_mark): - '''Callback function called after the function _get_img above. + '''Callback function called after the function helpers.download_image. ''' self._process_img(attrs, (mem, alt, img_mark)) @@ -628,8 +513,9 @@ update = True
1
0
0
0
gajim: add a Tor proxy in default configuration when Gajim start...
by Yann Leboulanger
14 Nov '11
14 Nov '11
changeset 01a491f62e59 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=01a491f62e59
description: add a Tor proxy in default configuration when Gajim starts. Fixes #7026 diffstat: src/common/config.py | 4 ++++ src/gui_interface.py | 12 ++++++++++++ 2 files changed, 16 insertions(+), 0 deletions(-) diffs (36 lines): diff -r 652a632afc58 -r 01a491f62e59 src/common/config.py --- a/src/common/config.py Mon Nov 14 18:32:18 2011 +0100 +++ b/src/common/config.py Mon Nov 14 18:44:17 2011 +0100 @@ -519,6 +519,10 @@ } + proxies_default = { + _('Tor'): ['socks5', 'localhost', 9050], + } + def foreach(self, cb, data = None): for opt in self.__options: cb(data, opt, None, self.__options[opt]) diff -r 652a632afc58 -r 01a491f62e59 src/gui_interface.py --- a/src/gui_interface.py Mon Nov 14 18:32:18 2011 +0100 +++ b/src/gui_interface.py Mon Nov 14 18:44:17 2011 +0100 @@ -2651,6 +2651,18 @@ for o in d: gajim.config.set_per('themes', theme_name, o, theme[d.index(o)]) + # Add Tor proxy if there is not in the config + if len(gajim.config.get_per('proxies')) == 0: + default = gajim.config.proxies_default + for proxy in default: + gajim.config.add_per('proxies', proxy) + gajim.config.set_per('proxies', proxy, 'type', + default[proxy][0]) + gajim.config.set_per('proxies', proxy, 'host', + default[proxy][1]) + gajim.config.set_per('proxies', proxy, 'port', + default[proxy][2]) + gajim.idlequeue = idlequeue.get_idlequeue() # resolve and keep current record of resolved hosts
1
0
0
0
gajim: save ssl fingerprint as soon as we accept a connection to...
by Yann Leboulanger
14 Nov '11
14 Nov '11
changeset 652a632afc58 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=652a632afc58
description: save ssl fingerprint as soon as we accept a connection to the host. Fixes #7041 diffstat: src/gui_interface.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff -r a1fd010bb6df -r 652a632afc58 src/gui_interface.py --- a/src/gui_interface.py Mon Nov 14 08:13:36 2011 +0300 +++ b/src/gui_interface.py Mon Nov 14 18:32:18 2011 +0100 @@ -1179,8 +1179,8 @@ f.write(server + '\n') f.write(obj.cert + '\n\n') f.close() - gajim.config.set_per('accounts', account, - 'ssl_fingerprint_sha1', obj.fingerprint) + gajim.config.set_per('accounts', account, 'ssl_fingerprint_sha1', + obj.fingerprint) if is_checked[1]: ignore_ssl_errors = gajim.config.get_per('accounts', account, 'ignore_ssl_errors').split()
1
0
0
0
gajim: correctly detect upower support. Fixes #7047
by Fomin Denis
14 Nov '11
14 Nov '11
changeset a1fd010bb6df in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=a1fd010bb6df
description: correctly detect upower support. Fixes #7047 diffstat: src/features_window.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diffs (22 lines): diff -r 2ffc7a85eff0 -r a1fd010bb6df src/features_window.py --- a/src/features_window.py Sun Nov 13 18:17:15 2011 +0100 +++ b/src/features_window.py Mon Nov 14 08:13:36 2011 +0300 @@ -111,7 +111,7 @@ _('Ability to request your router to forward port for file transfer.'), _('Requires python-gupnp-igd.'), _('Feature not available under Windows.')), - _('UPower'): (self.gupnp_igd_available, + _('UPower'): (self.upower_available, _('Ability to disconnect properly just before suspending the machine.'), _('Requires upower and python-dbus.'), _('Feature not available under Windows.')), @@ -260,3 +260,9 @@ def gupnp_igd_available(self): return gajim.HAVE_UPNP_IGD + + def upower_available(self): + if os.name == 'nt': + return False + import upower_listener + return upower_listener.supported
1
0
0
0
gajim: make google translator plugin work. Still much work to do...
by Yann Leboulanger
13 Nov '11
13 Nov '11
changeset 2ffc7a85eff0 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=2ffc7a85eff0
description: make google translator plugin work. Still much work to do about configuration diffstat: plugins/google_translation/plugin.py | 44 +++++++++++++++++------------------ 1 files changed, 21 insertions(+), 23 deletions(-) diffs (84 lines): diff -r 72c8a3da7612 -r 2ffc7a85eff0 plugins/google_translation/plugin.py --- a/plugins/google_translation/plugin.py Sun Nov 13 15:10:38 2011 +0100 +++ b/plugins/google_translation/plugin.py Sun Nov 13 18:17:15 2011 +0100 @@ -28,6 +28,7 @@ import re import urllib2 +import HTMLParser import new from pprint import pformat from sys import getfilesystemencoding @@ -47,7 +48,7 @@ self.description = _('Translates (currently only incoming)' 'messages using Google Translate.') self.config_dialog = None - #self.gui_extension_points = {} + self.config_default_values = { 'from_lang' : (u'en', u'Language of text to be translated'), @@ -59,12 +60,11 @@ u'User Agent data to be used with urllib2 ' 'when connecting to Google Translate service')} - #self.events_handlers = {} - - self.events = [GoogleTranslateMessageReceivedEvent] + self.events_handlers = {'decrypted-message-received': (ged.PREGUI, + self._nec_decrypted_message_received)} self.translated_text_re = re.compile( - r'google.language.callbacks.id100\(\'22\',' + r'google.language.callbacks.id100\(\'22\', ' '{"translatedText":"(?P<text>[^"]*)"}, 200, null, 200\)') @log_calls('GoogleTranslationPlugin') @@ -90,31 +90,29 @@ translated_text = self.translated_text_re.search(results).group('text') if translated_text: + try: + translated_text = unicode(translated_text, 'unicode_escape') + htmlparser = HTMLParser.HTMLParser() + translated_text = htmlparser.unescape(translated_text) + except Exception: + pass return translated_text return text @log_calls('GoogleTranslationPlugin') + def _nec_decrypted_message_received(self, obj): + if not obj.msgtxt: + return + from_lang = self.config['from_lang'] + to_lang = self.config['to_lang'] + translated_text = self.translate_text(obj.msgtxt, from_lang, to_lang) + if translated_text: + obj.msgtxt = translated_text + + @log_calls('GoogleTranslationPlugin') def activate(self): pass @log_calls('GoogleTranslationPlugin') def deactivate(self): pass - -class GoogleTranslateMessageReceivedEvent(nec.NetworkIncomingEvent): - name = 'google-translate-message-received' - base_network_events = ['raw-message-received'] - - def generate(self): - msg_type = self.base_event.stanza.attrs.get('type', None) - if msg_type == u'chat': - msg_text = "".join(self.base_event.stanza.kids[0].data) - if msg_text: - from_lang = self.plugin.config['from_lang'] - to_lang = self.plugin.config['to_lang'] - self.base_event.stanza.kids[0].setData( - self.plugin.translate_text(msg_text, from_lang, to_lang)) - - # We only want to modify old event, not emit another, so we return False - # here. - return False
1
0
0
0
gajim: use pycurl to download image in XHTML when a proxy is con...
by Yann Leboulanger
13 Nov '11
13 Nov '11
changeset 72c8a3da7612 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=72c8a3da7612
description: use pycurl to download image in XHTML when a proxy is configured. Fixes #7037 diffstat: src/common/gajim.py | 6 ++++ src/htmltextview.py | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 69 insertions(+), 3 deletions(-) diffs (106 lines): diff -r e5d5878642c7 -r 72c8a3da7612 src/common/gajim.py --- a/src/common/gajim.py Fri Nov 11 22:40:04 2011 +0300 +++ b/src/common/gajim.py Sun Nov 13 15:10:38 2011 +0100 @@ -191,6 +191,12 @@ except ImportError: HAVE_UPNP_IGD = False +HAVE_PYCURL = True +try: + __import__('pycurl') +except ImportError: + HAVE_PYCURL = False + gajim_identity = {'type': 'pc', 'category': 'client', 'name': 'Gajim'} gajim_common_features = [xmpp.NS_BYTESTREAM, xmpp.NS_SI, xmpp.NS_FILE, diff -r e5d5878642c7 -r 72c8a3da7612 src/htmltextview.py --- a/src/htmltextview.py Fri Nov 11 22:40:04 2011 +0300 +++ b/src/htmltextview.py Sun Nov 13 15:10:38 2011 +0100 @@ -54,6 +54,10 @@ import gtkgui_helpers from common import gajim from gtkgui_helpers import get_icon_pixmap +from common import helpers + +if gajim.HAVE_PYCURL: + import pycurl import tooltips import logging @@ -490,9 +494,10 @@ tag.title = title return tag - def _get_img(self, attrs): - '''Download an image. This function is launched in a separate thread. - ''' + def _get_img_direct(self, attrs): + """ + Download an image. This function is launched in a separate thread. + """ mem, alt = '', '' # Wait maximum 5s for connection socket.setdefaulttimeout(5) @@ -544,6 +549,61 @@ break return (mem, alt) + def _get_img_proxy(self, attrs, proxy): + """ + Download an image through a proxy. This function is launched in a + separate thread. + """ + if not gajim.HAVE_PYCURL: + return '', _('PyCURL is not installed') + mem, alt = '', '' + try: + b = StringIO() + c = pycurl.Curl() + c.setopt(pycurl.URL, attrs['src'].encode('utf-8')) + c.setopt(pycurl.FOLLOWLOCATION, 1) + c.setopt(pycurl.CONNECTTIMEOUT, 5) + c.setopt(pycurl.TIMEOUT, 10) + c.setopt(pycurl.MAXFILESIZE, 2000000) + c.setopt(pycurl.WRITEFUNCTION, b.write) + c.setopt(pycurl.USERAGENT, 'Gajim ' + gajim.version) + # set proxy + c.setopt(pycurl.PROXY, proxy['host'].encode('utf-8')) + c.setopt(pycurl.PROXYPORT, proxy['port']) + if proxy['useauth']: + c.setopt(pycurl.PROXYUSERPWD, proxy['user'].encode('utf-8')\ + + ':' + proxy['pass'].encode('utf-8')) + c.setopt(pycurl.PROXYAUTH, pycurl.HTTPAUTH_ANY) + if proxy['type'] == 'http': + c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP) + elif proxy['type'] == 'socks5': + c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5) + x = c.perform() + c.close() + t = b.getvalue() + return (t, attrs.get('alt', '')) + except pycurl.error, ex: + alt = attrs.get('alt', '') + if alt: + alt += '\n' + if ex[0] == pycurl.E_FILESIZE_EXCEEDED: + alt += _('Image is too big') + elif ex[0] == pycurl.E_OPERATION_TIMEOUTED: + alt += _('Timeout loading image') + else: + alt += _('Error loading image') + except Exception, ex: + log.debug('Error loading image %s ' % attrs['src'] + str(ex)) + pixbuf = None + alt = attrs.get('alt', 'Broken image') + return ('', alt) + + def _get_img(self, attrs): + proxy = helpers.get_proxy_info(self.conv_textview.account) + if proxy and proxy['type'] in ('http', 'socks5'): + return self._get_img_proxy(attrs, proxy) + return self._get_img_direct(attrs) + def _update_img(self, (mem, alt), attrs, img_mark): '''Callback function called after the function _get_img above. '''
1
0
0
0
gajim: Do not show ftp warning dialog in the check updates
by Fomin Denis
11 Nov '11
11 Nov '11
changeset e5d5878642c7 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=e5d5878642c7
description: Do not show ftp warning dialog in the check updates diffstat: plugins/plugin_installer/plugin_installer.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diffs (13 lines): diff -r 20d133dd6988 -r e5d5878642c7 plugins/plugin_installer/plugin_installer.py --- a/plugins/plugin_installer/plugin_installer.py Fri Nov 11 21:55:46 2011 +0300 +++ b/plugins/plugin_installer/plugin_installer.py Fri Nov 11 22:40:04 2011 +0300 @@ -107,8 +107,7 @@ con.quit() gobject.idle_add(self.warn_update, to_update) except Exception, e: - WarningDialog(_('Ftp error'), str(e), - gajim.interface.roster.window) + log.debug('Ftp error when check updates: %s' % str(e)) ftp = Ftp(self) ftp.run = _run ftp.start()
1
0
0
0
gajim: prevent traceback when check update from ftp. see https:/...
by Fomin Denis
11 Nov '11
11 Nov '11
changeset 20d133dd6988 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=20d133dd6988
description: prevent traceback when check update from ftp. see
https://trac.gajim.org/ticket/7023#comment:13
diffstat: plugins/plugin_installer/plugin_installer.py | 52 +++++++++++++++------------ 1 files changed, 28 insertions(+), 24 deletions(-) diffs (62 lines): diff -r 8a94c1a25462 -r 20d133dd6988 plugins/plugin_installer/plugin_installer.py --- a/plugins/plugin_installer/plugin_installer.py Thu Nov 10 23:19:39 2011 +0300 +++ b/plugins/plugin_installer/plugin_installer.py Fri Nov 11 21:55:46 2011 +0300 @@ -81,30 +81,34 @@ @log_calls('PluginInstallerPlugin') def check_update(self): def _run(): - to_update = [] - con = ftplib.FTP_TLS(ftp.server) - con.login() - con.prot_p() - con.cwd('plugins') - plugins_dirs = con.nlst() - for dir_ in plugins_dirs: - try: - con.retrbinary('RETR %s/manifest.ini' % dir_, - ftp.handleDownload) - except Exception, error: - if str(error).startswith('550'): - continue - ftp.config.readfp(io.BytesIO(ftp.buffer_.getvalue())) - local_version = ftp.get_plugin_version(ftp.config.get('info', - 'name')) - if local_version: - local = convert_version_to_list(local_version) - remote = convert_version_to_list(ftp.config.get('info', - 'version')) - if remote > local: - to_update.append(ftp.config.get('info', 'name')) - con.quit() - gobject.idle_add(self.warn_update, to_update) + try: + to_update = [] + con = ftplib.FTP_TLS(ftp.server) + con.login() + con.prot_p() + con.cwd('plugins') + plugins_dirs = con.nlst() + for dir_ in plugins_dirs: + try: + con.retrbinary('RETR %s/manifest.ini' % dir_, + ftp.handleDownload) + except Exception, error: + if str(error).startswith('550'): + continue + ftp.config.readfp(io.BytesIO(ftp.buffer_.getvalue())) + local_version = ftp.get_plugin_version(ftp.config.get( + 'info', 'name')) + if local_version: + local = convert_version_to_list(local_version) + remote = convert_version_to_list(ftp.config.get('info', + 'version')) + if remote > local: + to_update.append(ftp.config.get('info', 'name')) + con.quit() + gobject.idle_add(self.warn_update, to_update) + except Exception, e: + WarningDialog(_('Ftp error'), str(e), + gajim.interface.roster.window) ftp = Ftp(self) ftp.run = _run ftp.start()
1
0
0
0
← Newer
1
2
3
4
5
6
Older →
Jump to page:
1
2
3
4
5
6
Results per page:
10
25
50
100
200