remove become from python module
[disorder] / python / disorder.py.in
index 325599b..7b888b5 100644 (file)
@@ -375,7 +375,8 @@ class client:
           s.connect(self.who)
         self.w = s.makefile("wb")
         self.r = s.makefile("rb")
-        (res, challenge) = self._simple()
+        (res, challenge_and_algo) = self._simple()
+        (algo, challenge) = _split(challenge_and_algo)
         if cookie is None:
           if self.user is None:
             user = self.config['username']
@@ -385,6 +386,7 @@ class client:
             password = self.config['password']
           else:
             password = self.password
+          # TODO support algorithms other than SHA-1
           h = sha.sha()
           h.update(password)
           h.update(binascii.unhexlify(challenge))
@@ -411,16 +413,6 @@ class client:
   ########################################################################
   # Operations
 
-  def become(self, who):
-    """Become another user.
-
-    Arguments:
-    who -- the user to become.
-
-    Only trusted users can perform this operation.
-    """
-    self._simple("become", who)
-
   def play(self, track):
     """Play a track.
 
@@ -854,7 +846,7 @@ class client:
   def make_cookie(self):
     """Create a login cookie"""
     ret, details = self._simple("make-cookie")
-    return details
+    return _split(details)[0]
   
   def revoke(self):
     """Revoke a login cookie"""
@@ -879,6 +871,13 @@ class client:
     """Set user information"""
     self._simple("edituser", user, key, value)
 
+  def users(self):
+    """List all users
+
+    The return value is a list of all users."""
+    self._simple("users")
+    return self._body()
+
   ########################################################################
   # I/O infrastructure