Yann Leboulanger pushed to branch master at gajim / python-nbxmpp

Commits:

13 changed files:

Changes:

  • nbxmpp/auth_nb.py
    ... ... @@ -193,7 +193,7 @@ class SASL(PlugIn):
    193 193
             # If the server supports a mechanism disable all weaker mechanisms.
    
    194 194
             password_auth_mechs_strength = ['SCRAM-SHA-1-PLUS', 'SCRAM-SHA-1',
    
    195 195
                 'DIGEST-MD5', 'PLAIN', 'X-MESSENGER-OAUTH2']
    
    196
             if self.channel_binding == None:
    
    196
             if self.channel_binding is None:
    
    197 197
                 password_auth_mechs_strength.remove('SCRAM-SHA-1-PLUS')
    
    198 198
             for i in range(0, len(password_auth_mechs_strength)):
    
    199 199
                 if password_auth_mechs_strength[i] in self.mecs:
    
    ... ... @@ -243,7 +243,7 @@ class SASL(PlugIn):
    243 243
                     raise NodeProcessed
    
    244 244
                 except kerberos.GSSError as e:
    
    245 245
                     log.info('GSSAPI authentication failed: %s' % str(e))
    
    246
             if 'SCRAM-SHA-1-PLUS' in self.mecs and self.channel_binding != None:
    
    246
             if 'SCRAM-SHA-1-PLUS' in self.mecs and self.channel_binding is not None:
    
    247 247
                 self.mecs.remove('SCRAM-SHA-1-PLUS')
    
    248 248
                 self.mechanism = 'SCRAM-SHA-1-PLUS'
    
    249 249
                 self._owner._caller.get_password(self.set_password, self.mechanism)
    
    ... ... @@ -501,7 +501,7 @@ class SASL(PlugIn):
    501 501
                 self.client_nonce = '%x' % rndg.getrandbits(196)
    
    502 502
                 self.scram_soup = 'n=' + self.username + ',r=' + self.client_nonce
    
    503 503
                 if self.mechanism == 'SCRAM-SHA-1':
    
    504
                     if self.channel_binding == None:
    
    504
                     if self.channel_binding is None:
    
    505 505
                         # Client doesn't support Channel Binding
    
    506 506
                         self.scram_gs2 = 'n,,' # No CB yet.
    
    507 507
                     else:
    

  • nbxmpp/bosh.py
    ... ... @@ -493,8 +493,7 @@ def get_rand_number():
    493 493
         return rndg.getrandbits(50)
    
    494 494
     
    
    495 495
     
    
    496
     
    
    497
     class AckChecker():
    
    496
     class AckChecker(object):
    
    498 497
         """
    
    499 498
         Class for generating rids and generating and checking acknowledgements in
    
    500 499
         BOSH messages
    
    ... ... @@ -537,10 +536,7 @@ class AckChecker():
    537 536
             return self.rid
    
    538 537
     
    
    539 538
     
    
    540
     
    
    541
     
    
    542
     
    
    543
     class KeyStack():
    
    539
     class KeyStack(object):
    
    544 540
         """
    
    545 541
         Class implementing key sequences for BOSH messages
    
    546 542
         """
    

  • nbxmpp/client_nb.py
    ... ... @@ -29,7 +29,7 @@ import logging
    29 29
     log = logging.getLogger('nbxmpp.client_nb')
    
    30 30
     
    
    31 31
     
    
    32
     class NonBlockingClient:
    
    32
     class NonBlockingClient(object):
    
    33 33
         """
    
    34 34
         Client class is XMPP connection mountpoint. Objects for authentication,
    
    35 35
         network communication, roster, xml parsing ... are plugged to client object.
    
    ... ... @@ -499,10 +499,10 @@ class NonBlockingClient:
    499 499
                     if self.protocol_type != 'BOSH':
    
    500 500
                         self._channel_binding = self.Connection.NonBlockingTLS.get_channel_binding()
    
    501 501
                         # TLS handshake is finished so channel binding data muss exist
    
    502
                         assert (self._channel_binding != None)
    
    502
                         assert (self._channel_binding is not None)
    
    503 503
                 except NotImplementedError:
    
    504 504
                     pass
    
    505
             if auth_mechs == None:
    
    505
             if auth_mechs is None:
    
    506 506
                 self._auth_mechs = SASL_AUTHENTICATION_MECHANISMS | set(['XEP-0078'])
    
    507 507
             else:
    
    508 508
                 self._auth_mechs = auth_mechs
    
    ... ... @@ -557,7 +557,7 @@ class NonBlockingClient:
    557 557
             """
    
    558 558
             if data:
    
    559 559
                 self.Dispatcher.ProcessNonBlocking(data)
    
    560
             if not 'SASL' in self.__dict__:
    
    560
             if 'SASL' not in self.__dict__:
    
    561 561
                 # SASL is pluged out, possible disconnect
    
    562 562
                 return
    
    563 563
             if self.SASL.startsasl == 'in-process':
    

  • nbxmpp/dispatcher_nb.py
    ... ... @@ -43,7 +43,7 @@ DEFAULT_TIMEOUT_SECONDS = 25
    43 43
     XML_DECLARATION = '<?xml version=\'1.0\'?>'
    
    44 44
     
    
    45 45
     # FIXME: ugly
    
    46
     class Dispatcher():
    
    46
     class Dispatcher(object):
    
    47 47
         """
    
    48 48
         Why is this here - I needed to redefine Dispatcher for BOSH and easiest way
    
    49 49
         was to inherit original Dispatcher (now renamed to XMPPDispatcher). Trouble
    

  • nbxmpp/idlequeue.py
    ... ... @@ -76,7 +76,7 @@ def get_idlequeue():
    76 76
                 return SelectIdleQueue()
    
    77 77
     
    
    78 78
     
    
    79
     class IdleObject:
    
    79
     class IdleObject(object):
    
    80 80
         """
    
    81 81
         Idle listener interface. Listed methods are called by IdleQueue.
    
    82 82
         """
    
    ... ... @@ -216,7 +216,7 @@ class IdleCommand(IdleObject):
    216 216
             self._return_result()
    
    217 217
     
    
    218 218
     
    
    219
     class IdleQueue:
    
    219
     class IdleQueue(object):
    
    220 220
         """
    
    221 221
         IdleQueue provide three distinct time based features. Uses select.poll()
    
    222 222
     
    
    ... ... @@ -269,7 +269,7 @@ class IdleQueue:
    269 269
             Remove alarm callback alarm_cb scheduled on alarm_time. Returns True if
    
    270 270
             it was removed sucessfully, otherwise False
    
    271 271
             """
    
    272
             if not alarm_time in self.alarms:
    
    272
             if alarm_time not in self.alarms:
    
    273 273
                 return False
    
    274 274
             i = -1
    
    275 275
             for i in range(len(self.alarms[alarm_time])):
    
    ... ... @@ -278,7 +278,7 @@ class IdleQueue:
    278 278
                     break
    
    279 279
             if i != -1:
    
    280 280
                 del self.alarms[alarm_time][i]
    
    281
                 if self.alarms[alarm_time] == []:
    
    281
                 if not self.alarms[alarm_time]:
    
    282 282
                     del self.alarms[alarm_time]
    
    283 283
                 return True
    
    284 284
             else:
    

  • nbxmpp/plugin.py
    ... ... @@ -21,7 +21,8 @@ Provides PlugIn class functionality to develop extentions for xmpppy
    21 21
     import logging
    
    22 22
     log = logging.getLogger('nbxmpp.plugin')
    
    23 23
     
    
    24
     class PlugIn:
    
    24
     
    
    25
     class PlugIn(object):
    
    25 26
         """
    
    26 27
         Abstract xmpppy plugin infrastructure code, providing plugging in/out and
    
    27 28
         debugging functionality
    

  • nbxmpp/protocol.py
    ... ... @@ -605,7 +605,8 @@ stream_exceptions = {'bad-format': BadFormat,
    605 605
                         'unsupported-version': UnsupportedVersion,
    
    606 606
                         'xml-not-well-formed': XMLNotWellFormed}
    
    607 607
     
    
    608
     class JID:
    
    608
     
    
    609
     class JID(object):
    
    609 610
         """
    
    610 611
         JID can be built from string, modified, compared, serialised into string
    
    611 612
         """
    

  • nbxmpp/proxy_connectors.py
    ... ... @@ -27,7 +27,8 @@ from base64 import b64encode
    27 27
     import logging
    
    28 28
     log = logging.getLogger('nbxmpp.proxy_connectors')
    
    29 29
     
    
    30
     class ProxyConnector:
    
    30
     
    
    31
     class ProxyConnector(object):
    
    31 32
         """
    
    32 33
         Interface for proxy-connecting object - when tunnneling XMPP over proxies,
    
    33 34
         some connecting process usually has to be done before opening stream. Proxy
    

  • nbxmpp/roster_nb.py
    ... ... @@ -74,7 +74,7 @@ class NonBlockingRoster(PlugIn):
    74 74
             roster representation
    
    75 75
             """
    
    76 76
             sender = stanza.getAttr('from')
    
    77
             if not sender is None and not sender.bareMatch(
    
    77
             if sender is not None and not sender.bareMatch(
    
    78 78
             self._owner.User + '@' + self._owner.Server):
    
    79 79
                 return
    
    80 80
             query = stanza.getTag('query')
    

  • nbxmpp/simplexml.py
    ... ... @@ -485,7 +485,8 @@ class Node(object):
    485 485
                 return self.NT
    
    486 486
             raise AttributeError
    
    487 487
     
    
    488
     class T:
    
    488
     
    
    489
     class T(object):
    
    489 490
         """
    
    490 491
         Auxiliary class used to quick access to node's child nodes
    
    491 492
         """
    
    ... ... @@ -519,7 +520,8 @@ class NT(T):
    519 520
             else:
    
    520 521
                 return self.node.addChild(attr, payload=[val])
    
    521 522
     
    
    522
     class NodeBuilder:
    
    523
     
    
    524
     class NodeBuilder(object):
    
    523 525
         """
    
    524 526
         Builds a Node class minidom from data parsed to it. This class used for two
    
    525 527
         purposes:
    

  • nbxmpp/smacks.py
    ... ... @@ -3,14 +3,15 @@ from .protocol import NS_STREAM_MGMT
    3 3
     import logging
    
    4 4
     log = logging.getLogger('nbxmpp.smacks')
    
    5 5
     
    
    6
     class Smacks():
    
    7
         '''
    
    6
     
    
    7
     class Smacks(object):
    
    8
         """
    
    8 9
         This is Smacks is the Stream Management class. It takes care of requesting
    
    9 10
         and sending acks. Also, it keeps track of the unhandled outgoing stanzas.
    
    10 11
     
    
    11 12
         The dispatcher has to be able to access this class to increment the
    
    12 13
         number of handled stanzas
    
    13
         '''
    
    14
         """
    
    14 15
     
    
    15 16
         def __init__(self, con):
    
    16 17
             self.con = con # Connection object
    

  • nbxmpp/stringprepare.py
    ... ... @@ -25,7 +25,8 @@ import stringprep
    25 25
     import unicodedata
    
    26 26
     from encodings import idna
    
    27 27
     
    
    28
     class ILookupTable:
    
    28
     
    
    29
     class ILookupTable(object):
    
    29 30
         """
    
    30 31
         Interface for character lookup classes
    
    31 32
         """
    
    ... ... @@ -36,7 +37,8 @@ class ILookupTable:
    36 37
             """
    
    37 38
             pass
    
    38 39
     
    
    39
     class IMappingTable:
    
    40
     
    
    41
     class IMappingTable(object):
    
    40 42
         """
    
    41 43
         Interface for character mapping classes
    
    42 44
         """
    
    ... ... @@ -47,15 +49,15 @@ class IMappingTable:
    47 49
             """
    
    48 50
             pass
    
    49 51
     
    
    50
     class LookupTableFromFunction:
    
    51 52
     
    
    53
     class LookupTableFromFunction(object):
    
    52 54
         __implements__ = ILookupTable
    
    53 55
     
    
    54 56
         def __init__(self, in_table_function):
    
    55 57
             self.lookup = in_table_function
    
    56 58
     
    
    57
     class LookupTable:
    
    58 59
     
    
    60
     class LookupTable(object):
    
    59 61
         __implements__ = ILookupTable
    
    60 62
     
    
    61 63
         def __init__(self, table):
    
    ... ... @@ -64,15 +66,15 @@ class LookupTable:
    64 66
         def lookup(self, c):
    
    65 67
             return c in self._table
    
    66 68
     
    
    67
     class MappingTableFromFunction:
    
    68 69
     
    
    70
     class MappingTableFromFunction(object):
    
    69 71
         __implements__ = IMappingTable
    
    70 72
     
    
    71 73
         def __init__(self, map_table_function):
    
    72 74
             self.map = map_table_function
    
    73 75
     
    
    74
     class EmptyMappingTable:
    
    75 76
     
    
    77
     class EmptyMappingTable(object):
    
    76 78
         __implements__ = IMappingTable
    
    77 79
     
    
    78 80
         def __init__(self, in_table_function):
    
    ... ... @@ -149,7 +151,7 @@ class Profile:
    149 151
                 raise UnicodeError("Violation of BIDI Requirement 3")
    
    150 152
     
    
    151 153
     
    
    152
     class NamePrep:
    
    154
     class NamePrep(object):
    
    153 155
         """
    
    154 156
         Implements preparation of internationalized domain names
    
    155 157
     
    

  • nbxmpp/tls_nb.py
    ... ... @@ -56,7 +56,7 @@ def gattr(obj, attr, default=None):
    56 56
             return default
    
    57 57
     
    
    58 58
     
    
    59
     class SSLWrapper:
    
    59
     class SSLWrapper(object):
    
    60 60
         """
    
    61 61
         Abstract SSLWrapper base class
    
    62 62
         """