diff --git a/pyweb/mumble/MumbleCtlIce.py b/pyweb/mumble/MumbleCtlIce.py index 268cf47..731eeec 100644 --- a/pyweb/mumble/MumbleCtlIce.py +++ b/pyweb/mumble/MumbleCtlIce.py @@ -314,7 +314,17 @@ class MumbleCtlIce_120(MumbleCtlIce_118): self._getIceServerObject(srvid).unregisterUser(mumbleid) def getRegistration(self, srvid, mumbleid): - return self._getIceServerObject( srvid ).getRegistration( mumbleid ) + from Murmur import UserInfo + reg = self._getIceServerObject( srvid ).getRegistration( mumbleid ) + user = { + 'name': reg[UserInfo.UserName], + 'email': reg[UserInfo.UserEmail], + }; + if UserInfo.UserComment in reg: + user['comment'] = reg[UserInfo.UserComment]; + if UserInfo.UserHash in reg: + user['hash'] = reg[UserInfo.UserHash]; + return user; def setRegistration(self, srvid, mumbleid, name, email, password): from Murmur import UserInfo diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index 322499d..fbde6e7 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -396,6 +396,10 @@ class MumbleUser( models.Model ): is_channel = False; is_player = True; + def __init__( self, *args, **kwargs ): + models.Model.__init__( self, *args, **kwargs ); + self._registration = None; + def __unicode__( self ): return _("Mumble user %(mu)s on %(srv)s owned by Django user %(du)s") % { 'mu': self.name, 'srv': self.server, 'du': self.owner }; @@ -468,6 +472,31 @@ class MumbleUser( models.Model ): ctl.setACL(self.server.srvid, acl); return value; + # Registration fetching + def getRegistration( self ): + """Retrieve a user's registration from Murmur as a dict.""" + if not self._registration: + self._registration = self.server.ctl.getRegistration( self.server.srvid, self.mumbleid ); + return self._registration; + + registration = property( getRegistration, doc=getRegistration.__doc__ ); + + def getComment( self ): + """Retrieve a user's comment, if any.""" + if "comment" in self.registration: + return self.registration["comment"]; + else: + return None; + + comment = property( getComment, doc=getComment.__doc__ ); + + def getHash( self ): + if "hash" in self.registration: + return self.registration["hash"]; + else: + return None; + + hash = property( getHash, doc=getHash.__doc__ ); # Texture handlers diff --git a/template/mumble/mumble.htm b/template/mumble/mumble.htm index 378e1a0..c03180d 100644 --- a/template/mumble/mumble.htm +++ b/template/mumble/mumble.htm @@ -120,9 +120,17 @@
  • {% trans "Sign-up date" %}: {{ item.mumbleuser.owner.date_joined|date }}
  • {% endif %} + {% if item.mumbleuser and item.mumbleuser.comment %} +
    + {% trans "User Comment" %} + {{ item.mumbleuser.comment|safe }} +
    + {% endif %} {% if item.mumbleuser and item.mumbleuser.hasTexture %} -

    {% trans "User Texture" %}

    - user texture +
    + {% trans "User Texture" %} + user texture +
    {% endif %} {% else %}