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
December 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
147 discussions
Start a n
N
ew thread
gajim: implement XEP-0280: Message Carbons
by Yann Leboulanger
01 Dec '11
01 Dec '11
changeset e984e04fe876 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=e984e04fe876
description: implement XEP-0280: Message Carbons diffstat: src/chat_control.py | 10 +++--- src/common/config.py | 1 + src/common/connection.py | 7 ++++ src/common/connection_handlers_events.py | 46 ++++++++++++++++++++++++++++++- src/common/xmpp/protocol.py | 16 ++++++---- src/roster_window.py | 6 ++- src/session.py | 13 ++++++-- 7 files changed, 79 insertions(+), 20 deletions(-) diffs (245 lines): diff -r 5d7e25691db4 -r e984e04fe876 src/chat_control.py --- a/src/chat_control.py Sun Nov 06 12:25:41 2011 +0100 +++ b/src/chat_control.py Sun Nov 06 17:20:58 2011 +0100 @@ -2973,12 +2973,12 @@ kind = 'info' else: kind = 'print_queue' - dm = None - if len(data) > 10: - dm = data[10] + if data[11]: + kind = 'out' + dm = data[10] self.print_conversation(data[0], kind, tim=data[3], - encrypted=data[4], subject=data[1], xhtml=data[7], - displaymarking=dm) + encrypted=data[4], subject=data[1], xhtml=data[7], + displaymarking=dm) if len(data) > 6 and isinstance(data[6], int): message_ids.append(data[6]) diff -r 5d7e25691db4 -r e984e04fe876 src/common/config.py --- a/src/common/config.py Sun Nov 06 12:25:41 2011 +0100 +++ b/src/common/config.py Sun Nov 06 17:20:58 2011 +0100 @@ -381,6 +381,7 @@ 'roster_version': [opt_str, ''], 'subscription_request_msg': [opt_str, '', _('Message that is sent to contacts you want to add')], 'last_archiving_time': [opt_str, '1970-01-01T00:00:00Z', _('Last time we syncronized with logs from server.')], + 'enable_message_carbons': [ opt_bool, False, _('If enabled and if server supports this feature, Gajim will receive messages sent and received by other resources.')], }, {}), 'statusmsg': ({ 'message': [ opt_str, '' ], diff -r 5d7e25691db4 -r e984e04fe876 src/common/connection.py --- a/src/common/connection.py Sun Nov 06 12:25:41 2011 +0100 +++ b/src/common/connection.py Sun Nov 06 17:20:58 2011 +0100 @@ -1721,6 +1721,13 @@ self.archive_manual_supported = True if common.xmpp.NS_ARCHIVE_PREF in obj.features: self.archive_pref_supported = True + if common.xmpp.NS_CARBONS in obj.features and \ + gajim.config.get_per('accounts', self.name, + 'enable_message_carbons'): + # Server supports carbons, activate it + iq = common.xmpp.Iq('set') + iq.setTag('enable', namespace=common.xmpp.NS_CARBONS) + self.connection.send(iq) if common.xmpp.NS_BYTESTREAM in obj.features and \ gajim.config.get_per('accounts', self.name, 'use_ft_proxies'): our_fjid = helpers.parse_jid(our_jid + '/' + \ diff -r 5d7e25691db4 -r e984e04fe876 src/common/connection_handlers_events.py --- a/src/common/connection_handlers_events.py Sun Nov 06 12:25:41 2011 +0100 +++ b/src/common/connection_handlers_events.py Sun Nov 06 17:20:58 2011 +0100 @@ -988,6 +988,8 @@ self.conn = self.base_event.conn self.stanza = self.base_event.stanza self.get_id() + self.forwarded = False + self.sent = False account = self.conn.name @@ -1024,6 +1026,39 @@ return self.jid = gajim.get_jid_without_resource(self.fjid) + forward_tag = self.stanza.getTag('forwarded', namespace=xmpp.NS_FORWARD) + # Be sure it comes from one of our resource, else ignore forward element + if forward_tag and self.jid == gajim.get_jid_from_account(account): + received_tag = forward_tag.getTag('received', + namespace=xmpp.NS_CARBONS) + sent_tag = forward_tag.getTag('sent', namespace=xmpp.NS_CARBONS) + if received_tag: + msg = forward_tag.getTag('message') + self.stanza = xmpp.Message(node=msg) + try: + self.get_jid_resource() + except helpers.InvalidFormat: + self.conn.dispatch('ERROR', (_('Invalid Jabber ID'), + _('A message from a non-valid JID arrived, it has been ' + 'ignored.'))) + return + self.forwarded = True + elif sent_tag: + msg = forward_tag.getTag('message') + self.stanza = xmpp.Message(node=msg) + to = self.stanza.getTo() + self.stanza.setTo(self.stanza.getFrom()) + self.stanza.setFrom(to) + try: + self.get_jid_resource() + except helpers.InvalidFormat: + self.conn.dispatch('ERROR', (_('Invalid Jabber ID'), + _('A message from a non-valid JID arrived, it has been ' + 'ignored.'))) + return + self.forwarded = True + self.sent = True + self.enc_tag = self.stanza.getTag('x', namespace=xmpp.NS_ENCRYPTED) self.invite_tag = None @@ -1063,7 +1098,8 @@ self.session.last_receive = time_time() # check if the message is a XEP-0020 feature negotiation request - if self.stanza.getTag('feature', namespace=xmpp.NS_FEATURE): + if not self.forwarded and self.stanza.getTag('feature', + namespace=xmpp.NS_FEATURE): if gajim.HAVE_PYCRYPTO: feature = self.stanza.getTag(name='feature', namespace=xmpp.NS_FEATURE) @@ -1080,7 +1116,8 @@ self.conn.connection.send(reply) return - if self.stanza.getTag('init', namespace=xmpp.NS_ESESSION_INIT): + if not self.forwarded and self.stanza.getTag('init', + namespace=xmpp.NS_ESESSION_INIT): init = self.stanza.getTag(name='init', namespace=xmpp.NS_ESESSION_INIT) form = xmpp.DataForm(node=init.getTag('x')) @@ -1095,6 +1132,9 @@ xep_200_encrypted = self.stanza.getTag('c', namespace=xmpp.NS_STANZA_CRYPTO) if xep_200_encrypted: + if self.forwarded: + # Ignore E2E forwarded encrypted messages + return False self.encrypted = 'xep200' return True @@ -1166,6 +1206,8 @@ self.session = self.msg_obj.session self.timestamp = self.msg_obj.timestamp self.encrypted = self.msg_obj.encrypted + self.forwarded = self.msg_obj.forwarded + self.sent = self.msg_obj.sent self.popup = False self.receipt_request_tag = self.stanza.getTag('request', diff -r 5d7e25691db4 -r e984e04fe876 src/common/xmpp/protocol.py --- a/src/common/xmpp/protocol.py Sun Nov 06 12:25:41 2011 +0100 +++ b/src/common/xmpp/protocol.py Sun Nov 06 17:20:58 2011 +0100 @@ -47,10 +47,11 @@ NS_BOOKMARKS = 'storage:bookmarks' # XEP-0048 NS_BROWSE = 'jabber:iq:browse' NS_BROWSING = '
http://jabber.org/protocol/browsing
' # XEP-0195 -NS_BYTESTREAM = '
http://jabber.org/protocol/bytestreams
' # JEP-0065 -NS_CAPS = '
http://jabber.org/protocol/caps
' # JEP-0115 +NS_BYTESTREAM = '
http://jabber.org/protocol/bytestreams
' # XEP-0065 +NS_CAPS = '
http://jabber.org/protocol/caps
' # XEP-0115 NS_CAPTCHA = 'urn:xmpp:captcha' # XEP-0158 -NS_CHATSTATES = '
http://jabber.org/protocol/chatstates
' # JEP-0085 +NS_CARBONS = 'urn:xmpp:carbons:1' # XEP-0280 +NS_CHATSTATES = '
http://jabber.org/protocol/chatstates
' # XEP-0085 NS_CHATTING = '
http://jabber.org/protocol/chatting
' # XEP-0194 NS_CLIENT = 'jabber:client' NS_CONDITIONS = 'urn:xmpp:muc:conditions:0' # XEP-0306 @@ -70,9 +71,10 @@ NS_ENCRYPTED = 'jabber:x:encrypted' # XEP-0027 NS_ESESSION = '
http://www.xmpp.org/extensions/xep-0116.html#ns
' NS_ESESSION_INIT = '
http://www.xmpp.org/extensions/xep-0116.html#ns-init
' # XEP-0116 -NS_EVENT = 'jabber:x:event' # XEP-0022 +NS_EVENT = 'jabber:x:event' # XEP-0022 NS_FEATURE = '
http://jabber.org/protocol/feature-neg
' -NS_FILE = '
http://jabber.org/protocol/si/profile/file-transfer
' # JEP-0096 +NS_FILE = '
http://jabber.org/protocol/si/profile/file-transfer
' # XEP-0096 +NS_FORWARD = 'urn:xmpp:forward:0' # XEP-0297 NS_GAMING = '
http://jabber.org/protocol/gaming
' # XEP-0196 NS_GATEWAY = 'jabber:iq:gateway' # XEP-0100 NS_GEOLOC = '
http://jabber.org/protocol/geoloc
' # XEP-0080 @@ -102,7 +104,7 @@ NS_NICK = '
http://jabber.org/protocol/nick
' # XEP-0172 NS_OFFLINE = '
http://www.jabber.org/jeps/jep-0030.html
' # XEP-0013 NS_PHYSLOC = '
http://jabber.org/protocol/physloc
' # XEP-0112 -NS_PING = 'urn:xmpp:ping' # SEP-0199 +NS_PING = 'urn:xmpp:ping' # XEP-0199 NS_PRESENCE = 'presence' # Jabberd2 NS_PRIVACY = 'jabber:iq:privacy' NS_PRIVATE = 'jabber:iq:private' @@ -110,7 +112,7 @@ NS_PUBSUB = '
http://jabber.org/protocol/pubsub
' # XEP-0060 NS_PUBSUB_EVENT = '
http://jabber.org/protocol/pubsub#event
' NS_PUBSUB_PUBLISH_OPTIONS = NS_PUBSUB + '#publish-options' # XEP-0060 -NS_PUBSUB_OWNER = '
http://jabber.org/protocol/pubsub#owner
' # JEP-0060 +NS_PUBSUB_OWNER = '
http://jabber.org/protocol/pubsub#owner
' # XEP-0060 NS_REGISTER = 'jabber:iq:register' NS_ROSTER = 'jabber:iq:roster' NS_ROSTERNOTES = 'storage:rosternotes' diff -r 5d7e25691db4 -r e984e04fe876 src/roster_window.py --- a/src/roster_window.py Sun Nov 06 12:25:41 2011 +0100 +++ b/src/roster_window.py Sun Nov 06 17:20:58 2011 +0100 @@ -2584,10 +2584,12 @@ typ = '' if obj.mtype == 'error': typ = 'error' + if obj.forwarded and obj.sent: + typ = 'out' obj.session.control.print_conversation(obj.msgtxt, typ, - tim=obj.timestamp, encrypted=obj.encrypted, subject=obj.subject, - xhtml=obj.xhtml, displaymarking=obj.displaymarking) + tim=obj.timestamp, encrypted=obj.encrypted, subject=obj.subject, + xhtml=obj.xhtml, displaymarking=obj.displaymarking) if obj.msg_id: gajim.logger.set_read_messages([obj.msg_id]) elif obj.popup: diff -r 5d7e25691db4 -r e984e04fe876 src/session.py --- a/src/session.py Sun Nov 06 12:25:41 2011 +0100 +++ b/src/session.py Sun Nov 06 17:20:58 2011 +0100 @@ -79,9 +79,13 @@ if not obj.stanza.getTag('body') and obj.chatstate is None: return - log_type = 'chat_msg_recv' + log_type = 'chat_msg' else: - log_type = 'single_msg_recv' + log_type = 'single_msg' + end = '_recv' + if obj.forwarded and obj.sent: + end = '_sent' + log_type += end if self.is_loggable() and obj.msgtxt: try: @@ -113,7 +117,7 @@ # Handle chat states contact = gajim.contacts.get_contact(self.conn.name, obj.jid, obj.resource) - if contact: + if contact and (not obj.forwarded or not obj.sent): if contact.composing_xep != 'XEP-0085': # We cache xep85 support contact.composing_xep = obj.composing_xep if self.control and self.control.type_id == \ @@ -240,7 +244,8 @@ if not self.control: event = gajim.events.create_event(type_, (obj.msgtxt, obj.subject, obj.mtype, obj.timestamp, obj.encrypted, obj.resource, - obj.msg_id, obj.xhtml, self, obj.form_node, obj.displaymarking), + obj.msg_id, obj.xhtml, self, obj.form_node, obj.displaymarking, + obj.forwarded and obj.sent), show_in_roster=obj.show_in_roster, show_in_systray=obj.show_in_systray)
1
0
0
0
gajim: correctly escape file names when showing them in dialogs....
by Yann Leboulanger
01 Dec '11
01 Dec '11
changeset 5d7e25691db4 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=5d7e25691db4
description: correctly escape file names when showing them in dialogs. Fixes #7038 diffstat: src/filetransfers_window.py | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diffs (42 lines): diff -r d3dd568235c6 -r 5d7e25691db4 src/filetransfers_window.py --- a/src/filetransfers_window.py Sun Nov 06 11:46:00 2011 +0100 +++ b/src/filetransfers_window.py Sun Nov 06 12:25:41 2011 +0100 @@ -175,7 +175,8 @@ (file_path, file_name) = os.path.split(file_props['file-name']) else: file_name = file_props['name'] - sectext = '\t' + _('Filename: %s') % file_name + sectext = '\t' + _('Filename: %s') % gobject.markup_escape_text( + file_name) sectext += '\n\t' + _('Size: %s') % \ helpers.convert_bytes(file_props['size']) if file_props['type'] == 'r': @@ -231,7 +232,8 @@ file_name = os.path.basename(file_props['file-name']) else: file_name = file_props['name'] - sectext = '\t' + _('Filename: %s') % file_name + sectext = '\t' + _('Filename: %s') % gobject.markup_escape_text( + file_name) sectext += '\n\t' + _('Recipient: %s') % jid if error_msg: sectext += '\n\t' + _('Error message: %s') % error_msg @@ -328,7 +330,8 @@ if os.path.exists(file_path): # check if we have write permissions if not os.access(file_path, os.W_OK): - file_name = os.path.basename(file_path) + file_name = gobject.markup_escape_text(os.path.basename( + file_path)) dialogs.ErrorDialog( _('Cannot overwrite existing file "%s"' % file_name), _('A file with this name already exists and you do not ' @@ -590,7 +593,7 @@ iter_ = self.model.iter_next(iter_) def get_send_file_props(self, account, contact, file_path, file_name, - file_desc=''): + file_desc=''): """ Create new file_props dict and set initial file transfer properties in it """
1
0
0
0
gajim: generate 2048 bits keys instead of 384 bits keys when nee...
by Yann Leboulanger
01 Dec '11
01 Dec '11
changeset d3dd568235c6 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=d3dd568235c6
description: generate 2048 bits keys instead of 384 bits keys when needed. Fixes #7036 diffstat: src/secrets.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r e3a3c5a9e0b5 -r d3dd568235c6 src/secrets.py --- a/src/secrets.py Fri Nov 04 15:07:44 2011 +0100 +++ b/src/secrets.py Sun Nov 06 11:46:00 2011 +0100 @@ -87,7 +87,7 @@ try: pk = self.privkeys[account] except KeyError: - pk = Crypto.PublicKey.RSA.generate(384, crypto.random_bytes) + pk = Crypto.PublicKey.RSA.generate(2048, crypto.random_bytes) self.privkeys[account] = pk self.save()
1
0
0
0
gajim: don't log gpg passphrase to debug output. Fixes #7035
by Yann Leboulanger
01 Dec '11
01 Dec '11
changeset e3a3c5a9e0b5 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=e3a3c5a9e0b5
description: don't log gpg passphrase to debug output. Fixes #7035 diffstat: src/common/gnupg.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c967f10ba10f -r e3a3c5a9e0b5 src/common/gnupg.py --- a/src/common/gnupg.py Fri Nov 04 15:00:31 2011 +0100 +++ b/src/common/gnupg.py Fri Nov 04 15:07:44 2011 +0100 @@ -110,7 +110,7 @@ passphrase = '%s\n' % passphrase passphrase = passphrase.encode(encoding) stream.write(passphrase) - logger.debug("Wrote passphrase: %r", passphrase) + logger.debug("Passphrase written") def _is_sequence(instance): return isinstance(instance,list) or isinstance(instance,tuple)
1
0
0
0
gajim: auto-check for updates of installed plugins
by Yann Leboulanger
01 Dec '11
01 Dec '11
changeset 8e0a5a6e4ee4 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=8e0a5a6e4ee4
description: auto-check for updates of installed plugins diffstat: plugins/plugin_installer/manifest.ini | 3 +- plugins/plugin_installer/plugin_installer.py | 74 ++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 4 deletions(-) diffs (149 lines): diff -r 6146360ba52c -r 8e0a5a6e4ee4 plugins/plugin_installer/manifest.ini --- a/plugins/plugin_installer/manifest.ini Mon Oct 31 10:47:28 2011 +0100 +++ b/plugins/plugin_installer/manifest.ini Wed Nov 02 11:23:02 2011 +0100 @@ -1,7 +1,8 @@ [info] name: Plugin Installer short_name: plugin_installer -version: 0.3 +version: 0.4 description: Install and upgrade plugins from ftp authors: Denis Fomin <fominde(a)gmail.com> + Yann Leboulanger <asterix(a)lagaule.org> homepage:
http://www.gajim.org/
diff -r 6146360ba52c -r 8e0a5a6e4ee4 plugins/plugin_installer/plugin_installer.py --- a/plugins/plugin_installer/plugin_installer.py Mon Oct 31 10:47:28 2011 +0100 +++ b/plugins/plugin_installer/plugin_installer.py Wed Nov 02 11:23:02 2011 +0100 @@ -33,10 +33,17 @@ from common import gajim from plugins import GajimPlugin from plugins.helpers import log_calls, log -from dialogs import WarningDialog, HigDialog +from dialogs import WarningDialog, HigDialog, YesNoDialog from plugins.gui import GajimPluginConfigDialog +def convert_version_to_list(version_str): + version_list = version_str.split('.') + l = [] + while len(version_list): + l.append(int(version_list.pop(0))) + return l + class PluginInstaller(GajimPlugin): @log_calls('PluginInstallerPlugin') @@ -44,6 +51,10 @@ self.description = _('Install and upgrade plugins from ftp') self.config_dialog = PluginInstallerPluginConfigDialog(self) self.config_default_values = {'ftp_server': ('
ftp.gajim.org
', '')} + self.window = None + self.progressbar = None + self.available_plugins_model = None + self.upgrading = False # True when opened from upgrade popup dialog @log_calls('PluginInstallerPlugin') def activate(self): @@ -52,6 +63,50 @@ self.id_ = self.pl_menuitem.connect_after('activate', self.on_activate) if 'plugins' in gajim.interface.instances: self.on_activate(None) + gobject.timeout_add_seconds(30, self.check_update) + + @log_calls('PluginInstallerPlugin') + def warn_update(self, plugins): + def open_update(dummy): + self.upgrading = True + self.pl_menuitem.activate() + nb = gajim.interface.instances['plugins'].plugins_notebook + gobject.idle_add(nb.set_current_page, 1) + if plugins: + plugins_str = '\n'.join(plugins) + YesNoDialog(_('Plugins updates'), _('Some updates are available for' + ' your installer plugins. Do you want to update those plugins:' + '\n%s') % plugins_str, on_response_yes=open_update) + + @log_calls('PluginInstallerPlugin') + def check_update(self): + def _run(): + to_update = [] + con = ftplib.FTP(ftp.server) + con.login() + 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) + ftp = Ftp(self) + ftp.run = _run + ftp.start() @log_calls('PluginInstallerPlugin') def deactivate(self): @@ -152,12 +207,13 @@ else: self.inslall_upgrade_button.set_property('sensitive', True) - def on_notebook_switch_page(self, widget, page, page_num,): + def on_notebook_switch_page(self, widget, page, page_num): if not hasattr(self, 'ftp') and self.page_num == page_num: self.available_plugins_model.clear() self.progressbar.show() self.ftp = Ftp(self) self.ftp.remote_dirs = None + self.ftp.upgrading = True self.ftp.start() def on_inslall_upgrade_clicked(self, widget): @@ -309,6 +365,7 @@ class Ftp(threading.Thread): def __init__(self, plugin): super(Ftp, self).__init__() + self.plugin = plugin self.window = plugin.window self.server = plugin.config['ftp_server'] self.progressbar = plugin.progressbar @@ -317,6 +374,7 @@ self.buffer_ = io.BytesIO() self.remote_dirs = None self.append_to_model = True + self.upgrading = False def model_append(self, row): self.model.append(row) @@ -357,9 +415,19 @@ self.config.readfp(io.BytesIO(self.buffer_.getvalue())) local_version = self.get_plugin_version( self.config.get('info', 'name')) + upgrade = False + if self.upgrading and local_version: + local = convert_version_to_list(local_version) + remote = convert_version_to_list(self.config.get('info', + 'version')) + if remote > local: + upgrade = True + gobject.idle_add( + self.plugin.inslall_upgrade_button.set_property, + 'sensitive', True) gobject.idle_add(self.model_append, [dir_, self.config.get('info', 'name'), local_version, - self.config.get('info', 'version'), False, + self.config.get('info', 'version'), upgrade, self.config.get('info', 'description'), self.config.get('info', 'authors'), self.config.get('info', 'homepage'), ])
1
0
0
0
gajim: fix SSLError dialog. Fixes #7033
by Yann Leboulanger
01 Dec '11
01 Dec '11
changeset c967f10ba10f in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=c967f10ba10f
description: fix SSLError dialog. Fixes #7033 diffstat: src/dialogs.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff -r 8e0a5a6e4ee4 -r c967f10ba10f src/dialogs.py --- a/src/dialogs.py Wed Nov 02 11:23:02 2011 +0100 +++ b/src/dialogs.py Fri Nov 04 15:00:31 2011 +0100 @@ -5239,8 +5239,8 @@ self.account = account self.cert = certificate ConfirmationDialogDoubleCheck.__init__(self, pritext, sectext, - checktext1, checktext2, on_response_ok, on_response_cancel, - is_modal=False) + checktext1, checktext2, on_response_ok=on_response_ok, + on_response_cancel=on_response_cancel, is_modal=False) b = gtk.Button(_('View cert...')) b.connect('clicked', self.on_cert_clicked) b.show_all()
1
0
0
0
gajim: import some improvements from xmpppy and use it where it'...
by Yann Leboulanger
01 Dec '11
01 Dec '11
changeset 6146360ba52c in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=6146360ba52c
description: import some improvements from xmpppy and use it where it's usefull diffstat: src/common/connection.py | 24 +++++++++--------- src/common/connection_handlers.py | 20 +++++++------- src/common/xmpp/protocol.py | 51 +++++++++++++++++++++++++++++--------- 3 files changed, 60 insertions(+), 35 deletions(-) diffs (truncated from 312 to 300 lines): diff -r a5e3cea728db -r 6146360ba52c src/common/connection.py --- a/src/common/connection.py Mon Oct 31 09:52:23 2011 +0100 +++ b/src/common/connection.py Mon Oct 31 10:47:28 2011 +0100 @@ -1515,14 +1515,14 @@ Build a Privacy rule stanza for invisibility """ iq = common.xmpp.Iq('set', common.xmpp.NS_PRIVACY, xmlns = '') - l = iq.getTag('query').setTag('list', {'name': name}) + l = iq.setQuery().setTag('list', {'name': name}) i = l.setTag('item', {'action': action, 'order': str(order)}) i.setTag('presence-out') return iq def build_invisible_rule(self): iq = common.xmpp.Iq('set', common.xmpp.NS_PRIVACY, xmlns = '') - l = iq.getTag('query').setTag('list', {'name': 'invisible'}) + l = iq.setQuery().setTag('list', {'name': 'invisible'}) if self.name in gajim.interface.status_sent_to_groups and \ len(gajim.interface.status_sent_to_groups[self.name]) > 0: for group in gajim.interface.status_sent_to_groups[self.name]: @@ -1552,7 +1552,7 @@ if not gajim.account_is_connected(self.name): return iq = common.xmpp.Iq('set', common.xmpp.NS_PRIVACY, xmlns = '') - iq.getTag('query').setTag('active', {'name': name}) + iq.setQuery().setTag('active', {'name': name}) self.connection.send(iq) def send_invisible_presence(self, msg, signed, initial = False): @@ -1905,7 +1905,7 @@ if name: infos['name'] = name iq = common.xmpp.Iq('set', common.xmpp.NS_ROSTER) - q = iq.getTag('query') + q = iq.setQuery() item = q.addChild('item', attrs=infos) for g in groups: item.addChild('group').setData(g) @@ -1950,7 +1950,7 @@ if not gajim.account_is_connected(self.name): return iq = common.xmpp.Iq('set', common.xmpp.NS_REGISTER, to = agent) - iq.getTag('query').setTag('remove') + iq.setQuery().setTag('remove') id_ = self.connection.getAnID() iq.setID(id_) self.awaiting_answers[id_] = (AGENT_REMOVED, agent) @@ -2408,7 +2408,7 @@ return iq = common.xmpp.Iq(typ = 'set', queryNS = common.xmpp.NS_MUC_OWNER, to = room_jid) - destroy = iq.getTag('query').setTag('destroy') + destroy = iq.setQuery().setTag('destroy') if reason: destroy.setTagData('reason', reason) if jid: @@ -2455,7 +2455,7 @@ return iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS =\ common.xmpp.NS_MUC_ADMIN) - item = iq.getTag('query').setTag('item') + item = iq.setQuery().setTag('item') item.setAttr('nick', nick) item.setAttr('role', role) if reason: @@ -2470,7 +2470,7 @@ return iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS =\ common.xmpp.NS_MUC_ADMIN) - item = iq.getTag('query').setTag('item') + item = iq.setQuery().setTag('item') item.setAttr('jid', jid) item.setAttr('affiliation', affiliation) if reason: @@ -2482,7 +2482,7 @@ return iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS = \ common.xmpp.NS_MUC_ADMIN) - item = iq.getTag('query') + item = iq.setQuery() for jid in users_dict: item_tag = item.addChild('item', {'jid': jid, 'affiliation': users_dict[jid]['affiliation']}) @@ -2495,7 +2495,7 @@ return iq = common.xmpp.Iq(typ = 'get', to = room_jid, queryNS = \ common.xmpp.NS_MUC_ADMIN) - item = iq.getTag('query').setTag('item') + item = iq.setQuery().setTag('item') item.setAttr('affiliation', affiliation) self.connection.send(iq) @@ -2504,7 +2504,7 @@ return iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS =\ common.xmpp.NS_MUC_OWNER) - query = iq.getTag('query') + query = iq.setQuery() form.setAttr('type', 'submit') query.addChild(node = form) self.connection.send(iq) @@ -2629,7 +2629,7 @@ def send_search_form(self, jid, form, is_form): iq = common.xmpp.Iq(typ = 'set', to = jid, queryNS = \ common.xmpp.NS_SEARCH) - item = iq.getTag('query') + item = iq.setQuery() if is_form: item.addChild(node=form) else: diff -r a5e3cea728db -r 6146360ba52c src/common/connection_handlers.py --- a/src/common/connection_handlers.py Mon Oct 31 09:52:23 2011 +0100 +++ b/src/common/connection_handlers.py Mon Oct 31 10:47:28 2011 +0100 @@ -151,7 +151,7 @@ return if is_form: iq = common.xmpp.Iq('set', common.xmpp.NS_REGISTER, to=agent) - query = iq.getTag('query') + query = iq.setQuery() info.setAttr('type', 'submit') query.addChild(node=info) self.connection.SendAndCallForResponse(iq, @@ -233,8 +233,7 @@ log.debug('DiscoverInfoGetCB') if not self.connection or self.connected < 2: return - q = iq_obj.getTag('query') - node = q.getAttr('node') + node = iq_obj.getQuerynode() if self.commandInfoQuery(con, iq_obj): raise common.xmpp.NodeProcessed @@ -245,7 +244,7 @@ raise common.xmpp.NodeProcessed iq = iq_obj.buildReply('result') - q = iq.getTag('query') + q = iq.setQuery() if node: q.setAttr('node', node) q.addChild('identity', attrs=gajim.gajim_identity) @@ -390,7 +389,7 @@ iq = common.xmpp.Iq(typ='get') if jid: iq.setTo(jid) - iq.setTag(common.xmpp.NS_VCARD + ' vCard') + iq.setQuery('vCard').setNamespace(common.xmpp.NS_VCARD) id_ = self.connection.getAnID() iq.setID(id_) @@ -532,6 +531,8 @@ return if iq_obj.getType() == 'result': query = iq_obj.getTag('query') + if not query: + return delimiter = query.getTagData('roster') if delimiter: self.nested_group_delimiter = delimiter @@ -651,9 +652,8 @@ with_ = element.getAttr('with') start_ = element.getAttr('start') self.request_collection_page(with_, start_) - elif element.getName() == 'removed': + #elif element.getName() == 'removed': # do nothing - pass del self.awaiting_answers[id_] @@ -1471,7 +1471,7 @@ if obj.conn.name != self.name: return iq_obj = obj.stanza.buildReply('result') - qp = iq_obj.getTag('query') + qp = iq_obj.setQuery() qp.setTagData('name', 'Gajim') qp.setTagData('version', gajim.version) send_os = gajim.config.get_per('accounts', self.name, 'send_os_info') @@ -1494,7 +1494,7 @@ if HAS_IDLE and gajim.config.get_per('accounts', self.name, 'send_idle_time'): iq_obj = obj.stanza.buildReply('result') - qp = iq_obj.getTag('query') + qp = iq_obj.setQuery() qp.attrs['seconds'] = int(self.sleeper.getIdleSec()) else: iq_obj = obj.stanza.buildReply('error') @@ -1521,7 +1521,7 @@ return if gajim.config.get_per('accounts', self.name, 'send_time_info'): iq_obj = obj.stanza.buildReply('result') - qp = iq_obj.getTag('query') + qp = iq_obj.setQuery() qp.setTagData('utc', strftime('%Y%m%dT%H:%M:%S', gmtime())) qp.setTagData('tz', helpers.decode_string(tzname[daylight])) qp.setTagData('display', helpers.decode_string(strftime('%c', diff -r a5e3cea728db -r 6146360ba52c src/common/xmpp/protocol.py --- a/src/common/xmpp/protocol.py Mon Oct 31 09:52:23 2011 +0100 +++ b/src/common/xmpp/protocol.py Mon Oct 31 10:47:28 2011 +0100 @@ -779,10 +779,11 @@ def buildReply(self, text=None): """ Builds and returns another message object with specified text. The to, - from and thread properties of new message are pre-set as reply to this - message + from, thread and type properties of new message are pre-set as reply to + this message """ - m = Message(to=self.getFrom(), frm=self.getTo(), body=text) + m = Message(to=self.getFrom(), frm=self.getTo(), body=text, + typ=self.getType()) th = self.getThread() if th: m.setThread(th) @@ -939,11 +940,20 @@ if queryNS: self.setQueryNS(queryNS) + def getQuery(self): + """ + Return the IQ's child element if it exists, None otherwise. + """ + children = self.getChildren() + if children and self.getType() != 'error' and \ + children[0].getName() != 'error': + return children[0] + def getQueryNS(self): """ Return the namespace of the 'query' child element """ - tag = self.getTag('query') + tag = self.getQuery() if tag: return tag.getNamespace() @@ -951,13 +961,15 @@ """ Return the 'node' attribute value of the 'query' child element """ - return self.getTagAttr('query', 'node') + tag = self.getQuery() + if tag: + return tag.getAttr('node') def getQueryPayload(self): """ Return the 'query' child element payload """ - tag = self.getTag('query') + tag = self.getQuery() if tag: return tag.getPayload() @@ -965,36 +977,49 @@ """ Return the 'query' child element child nodes """ - tag = self.getTag('query') + tag = self.getQuery() if tag: return tag.getChildren() + def setQuery(self, name=None): + """ + Change the name of the query node, creating it if needed. Keep the + existing name if none is given (use 'query' if it's a creation). + Return the query node. + """ + query = self.getQuery() + if query is None: + query = self.addChild('query') + if name is not None: + query.setName(name) + return query + def setQueryNS(self, namespace): """ Set the namespace of the 'query' child element """ - self.setTag('query').setNamespace(namespace) + self.setQuery().setNamespace(namespace) def setQueryPayload(self, payload): """ Set the 'query' child element payload """ - self.setTag('query').setPayload(payload) + self.setQuery().setPayload(payload) def setQuerynode(self, node): """ Set the 'node' attribute value of the 'query' child element """ - self.setTagAttr('query', 'node', node) + self.setQuery().setAttr('node', node) def buildReply(self, typ): """
1
0
0
0
gajim: correctly unregister events when closing a groupchat
by Yann Leboulanger
01 Dec '11
01 Dec '11
changeset a5e3cea728db in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=a5e3cea728db
description: correctly unregister events when closing a groupchat diffstat: src/groupchat_control.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r c6f70bf89f28 -r a5e3cea728db src/groupchat_control.py --- a/src/groupchat_control.py Mon Oct 31 09:47:01 2011 +0100 +++ b/src/groupchat_control.py Mon Oct 31 09:52:23 2011 +0100 @@ -1929,6 +1929,8 @@ self._nec_gc_config_changed_received) gajim.ged.remove_event_handler('signed-in', ged.GUI1, self._nec_signed_in) + gajim.ged.remove_event_handler('decrypted-message-received', ged.GUI2, + self._nec_decrypted_message_received) if self.room_jid in gajim.gc_connected[self.account] and \ gajim.gc_connected[self.account][self.room_jid]:
1
0
0
0
gajim: change the insecure connection dialog behaviour. Fixes #7019
by Yann Leboulanger
01 Dec '11
01 Dec '11
changeset c6f70bf89f28 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=c6f70bf89f28
description: change the insecure connection dialog behaviour. Fixes #7019 diffstat: src/common/config.py | 2 +- src/common/connection.py | 8 +++++++- src/dialogs.py | 7 ++++++- src/gui_interface.py | 15 ++++++++++----- 4 files changed, 24 insertions(+), 8 deletions(-) diffs (109 lines): diff -r 1dc95b110ec2 -r c6f70bf89f28 src/common/config.py --- a/src/common/config.py Sun Oct 30 13:27:32 2011 +0100 +++ b/src/common/config.py Mon Oct 31 09:47:01 2011 +0100 @@ -323,7 +323,7 @@ 'enable_esessions': [opt_bool, True, _('Enable ESessions encryption for this account.')], 'autonegotiate_esessions': [opt_bool, True, _('Should Gajim automatically start an encrypted session when possible?')], 'connection_types': [ opt_str, 'tls ssl plain', _('Ordered list (space separated) of connection type to try. Can contain tls, ssl or plain')], - 'warn_when_plaintext_connection': [ opt_bool, True, _('Show a warning dialog before sending password on an plaintext connection.') ], + 'action_when_plaintext_connection': [ opt_str, 'warn', _('Show a warning dialog before sending password on an plaintext connection. Can be \'warn\', \'connect\', \'disconnect\'') ], 'warn_when_insecure_ssl_connection': [ opt_bool, True, _('Show a warning dialog before using standard SSL library.') ], 'warn_when_insecure_password': [ opt_bool, True, _('Show a warning dialog before sending PLAIN password over a plain connection.') ], 'ssl_fingerprint_sha1': [ opt_str, '', '', True ], diff -r 1dc95b110ec2 -r c6f70bf89f28 src/common/connection.py --- a/src/common/connection.py Sun Oct 30 13:27:32 2011 +0100 +++ b/src/common/connection.py Mon Oct 31 09:47:01 2011 +0100 @@ -1266,10 +1266,16 @@ return con.RegisterDisconnectHandler(self._on_disconnected) if _con_type == 'plain' and gajim.config.get_per('accounts', self.name, - 'warn_when_plaintext_connection'): + 'action_when_plaintext_connection') == 'warn': gajim.nec.push_incoming_event(PlainConnectionEvent(None, conn=self, xmpp_client=con)) return True + if _con_type == 'plain' and gajim.config.get_per('accounts', self.name, + 'action_when_plaintext_connection') == 'disconnect': + self.disconnect(on_purpose=True) + gajim.nec.push_incoming_event(OurShowEvent(None, conn=self, + show='offline')) + return False if _con_type in ('tls', 'ssl') and con.Connection.ssl_lib != 'PYOPENSSL' \ and gajim.config.get_per('accounts', self.name, 'warn_when_insecure_ssl_connection') and \ diff -r 1dc95b110ec2 -r c6f70bf89f28 src/dialogs.py --- a/src/dialogs.py Sun Oct 30 13:27:32 2011 +0100 +++ b/src/dialogs.py Mon Oct 31 09:47:01 2011 +0100 @@ -1722,7 +1722,8 @@ """ def __init__(self, pritext, sectext='', checktext1='', checktext2='', - on_response_ok=None, on_response_cancel=None, is_modal=True): + tooltip1='', tooltip2='', on_response_ok=None, on_response_cancel=None, + is_modal=True): self.user_response_ok = on_response_ok self.user_response_cancel = on_response_cancel @@ -1741,11 +1742,15 @@ if checktext1: self.checkbutton1 = gtk.CheckButton(checktext1) + if tooltip1: + self.checkbutton1.set_tooltip_text(tooltip1) self.vbox.pack_start(self.checkbutton1, expand=False, fill=True) else: self.checkbutton1 = None if checktext2: self.checkbutton2 = gtk.CheckButton(checktext2) + if tooltip2: + self.checkbutton2.set_tooltip_text(tooltip2) self.vbox.pack_start(self.checkbutton2, expand=False, fill=True) else: self.checkbutton2 = None diff -r 1dc95b110ec2 -r c6f70bf89f28 src/gui_interface.py --- a/src/gui_interface.py Sun Oct 30 13:27:32 2011 +0100 +++ b/src/gui_interface.py Mon Oct 31 09:47:01 2011 +0100 @@ -1254,6 +1254,9 @@ # ('PLAIN_CONNECTION', account, (connection)) def on_ok(is_checked): if not is_checked[0]: + if is_checked[1]: + gajim.config.set_per('accounts', obj.conn.name, + 'action_when_plaintext_connection', 'disconnect') on_cancel() return # On cancel call del self.instances, so don't call it another time @@ -1262,7 +1265,7 @@ ['plain_connection'] if is_checked[1]: gajim.config.set_per('accounts', obj.conn.name, - 'warn_when_plaintext_connection', False) + 'action_when_plaintext_connection', 'connect') obj.conn.connection_accepted(obj.xmpp_client, 'plain') def on_cancel(): @@ -1275,18 +1278,20 @@ pritext = _('Insecure connection') sectext = _('You are about to connect to the account %(account)s ' '(%(server)s) with an insecure connection. This means all your ' - 'conversations will be exchanged unencrypted. Are you sure you ' - 'want to do that?') % {'account': obj.conn.name, + 'conversations will be exchanged unencrypted. This type of ' + 'connection is really discouraged.\nAre you sure you want to do ' + 'that?') % {'account': obj.conn.name, 'server': gajim.get_hostname_from_account(obj.conn.name)} checktext1 = _('Yes, I really want to connect insecurely') + tooltip1 = _('Gajim will NOT connect unless you check this box') checktext2 = _('_Do not ask me again') if 'plain_connection' in self.instances[obj.conn.name]['online_dialog']: self.instances[obj.conn.name]['online_dialog']['plain_connection'].\ destroy() self.instances[obj.conn.name]['online_dialog']['plain_connection'] = \ dialogs.ConfirmationDialogDoubleCheck(pritext, sectext, checktext1, - checktext2, on_response_ok=on_ok, on_response_cancel=on_cancel, - is_modal=False) + checktext2, tooltip1=tooltip1, on_response_ok=on_ok, + on_response_cancel=on_cancel, is_modal=False) def handle_event_insecure_ssl_connection(self, obj): # ('INSECURE_SSL_CONNECTION', account, (connection, connection_type))
1
0
0
0
gajim: implement XEP-0306 : status conditions for MUC
by Yann Leboulanger
01 Dec '11
01 Dec '11
changeset 1dc95b110ec2 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=1dc95b110ec2
description: implement XEP-0306 : status conditions for MUC diffstat: src/common/connection_handlers_events.py | 41 ++++++++++++++++++++++++++++++- src/common/xmpp/protocol.py | 12 +++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) diffs (94 lines): diff -r 49b3bd055081 -r 1dc95b110ec2 src/common/connection_handlers_events.py --- a/src/common/connection_handlers_events.py Sun Oct 30 13:26:41 2011 +0100 +++ b/src/common/connection_handlers_events.py Sun Oct 30 13:27:32 2011 +0100 @@ -41,6 +41,28 @@ import logging log = logging.getLogger('gajim.c.connection_handlers_events') +CONDITION_TO_CODE = { + 'realjid-public': 100, + 'affiliation-changed': 101, + 'unavailable-shown': 102, + 'unavailable-not-shown': 103, + 'configuration-changed': 104, + 'self-presence': 110, + 'logging-enabled': 170, + 'logging-disabled': 171, + 'non-anonymous': 172, + 'semi-anonymous': 173, + 'fully-anonymous': 174, + 'room-created': 201, + 'nick-assigned': 210, + 'banned': 301, + 'new-nick': 303, + 'kicked': 307, + 'removed-affiliation': 321, + 'removed-membership': 322, + 'removed-shutdown': 332, +} + class HelperEvent: def get_jid_resource(self, check_fake_jid=False): if check_fake_jid and hasattr(self, 'id_') and \ @@ -909,7 +931,15 @@ self.status_code = ['destroyed'] else: self.reason = self.stanza.getReason() - self.status_code = self.stanza.getStatusCode() + conditions = self.stanza.getStatusConditions() + if conditions: + self.status_code = [] + for condition in conditions: + if condition in CONDITION_TO_CODE: + self.status_code.append(CONDITION_TO_CODE[condition]) + else: + self.status_code = self.stanza.getStatusCode() + self.role = self.stanza.getRole() self.affiliation = self.stanza.getAffiliation() self.real_jid = self.stanza.getJid() @@ -1210,7 +1240,14 @@ conn=self.conn, msg_event=self)) return - self.status_code = self.stanza.getStatusCode() + conditions = self.stanza.getStatusConditions() + if conditions: + self.status_code = [] + for condition in conditions: + if condition in CONDITION_TO_CODE: + self.status_code.append(CONDITION_TO_CODE[condition]) + else: + self.status_code = self.stanza.getStatusCode() if not self.stanza.getTag('body'): # no <body> # It could be a config change. See diff -r 49b3bd055081 -r 1dc95b110ec2 src/common/xmpp/protocol.py --- a/src/common/xmpp/protocol.py Sun Oct 30 13:26:41 2011 +0100 +++ b/src/common/xmpp/protocol.py Sun Oct 30 13:27:32 2011 +0100 @@ -53,6 +53,7 @@ NS_CHATSTATES = '
http://jabber.org/protocol/chatstates
' # JEP-0085 NS_CHATTING = '
http://jabber.org/protocol/chatting
' # XEP-0194 NS_CLIENT = 'jabber:client' +NS_CONDITIONS = 'urn:xmpp:muc:conditions:0' # XEP-0306 NS_COMMANDS = '
http://jabber.org/protocol/commands
' NS_COMPONENT_ACCEPT = 'jabber:component:accept' NS_COMPONENT_1 = '
http://jabberd.jabberstudio.org/ns/component/1.0
' @@ -625,6 +626,17 @@ """ return self.getTagAttr('error', 'code') + def getStatusConditions(self): + """ + Return the status conditions list as defined in XEP-0306. + """ + conds = [] + condtag = self.getTag('conditions', namespace=NS_CONDITIONS) + if condtag: + for tag in condtag.getChildren(): + conds.append(tag.getName()) + return conds + def setError(self, error, code=None): """ Set the error code. Obsolete. Use error-conditions instead
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Results per page:
10
25
50
100
200