File fix-hashlib-warning.dif of Package python-jabberpy

Index: jabberpy-0.5-0/jabber/jabber.py
===================================================================
--- jabberpy-0.5-0.orig/jabber/jabber.py
+++ jabberpy-0.5-0/jabber/jabber.py
@@ -65,7 +65,18 @@ An example of usage for a simple client
 # $Id: jabber.py,v 1.58 2004/01/18 05:27:10 snakeru Exp $
 
 import xmlstream
-import sha, time
+import time
+try:
+    import hashlib
+except ImportError:
+    import sha
+    class hashlib:
+        def new(checksum):
+            if checksum == 'sha1':
+                return sha.new()
+            else:
+                raise ValueError("Incompatible checksum type")
+        new = staticmethod(new)
 
 debug=xmlstream.debug
 
@@ -524,15 +535,15 @@ class Client(Connection):
             token = auth_ret_query.getTag('token').getData()
             seq = auth_ret_query.getTag('sequence').getData()
             self.DEBUG("zero-k authentication supported",(DBG_INIT,DBG_NODE_IQ))
-            hash = sha.new(sha.new(passwd).hexdigest()+token).hexdigest()
-            for foo in xrange(int(seq)): hash = sha.new(hash).hexdigest()
+            hash = hashlib.new('sha1', hashlib.new('sha1', passwd).hexdigest()+token).hexdigest()
+            for foo in xrange(int(seq)): hash = hashlib.new('sha1', hash).hexdigest()
             q.insertTag('hash').insertData(hash)
 
         elif auth_ret_query.getTag('digest'):
 
             self.DEBUG("digest authentication supported",(DBG_INIT,DBG_NODE_IQ))
             digest = q.insertTag('digest')
-            digest.insertData(sha.new(
+            digest.insertData(hashlib.new('sha1',
                 self.getIncomingID() + passwd).hexdigest() )
         else:
             self.DEBUG("plain text authentication supported",(DBG_INIT,DBG_NODE_IQ))
@@ -1397,7 +1408,7 @@ class Component(Connection):
     def auth(self,secret):
         """will disconnect on failure"""
         self.send( u"<handshake id='1'>%s</handshake>"
-                   % sha.new( self.getIncomingID() + secret ).hexdigest()
+                   % hashlib.new('sha1', self.getIncomingID() + secret ).hexdigest()
                   )
         while not self._auth_OK:
             self.DEBUG("waiting on handshake")
openSUSE Build Service is sponsored by