Browse Source

add getUptime() to the ctls

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
6d1f391a7e
  1. 2
      pyweb/mumble/MumbleCtlDbus.py
  2. 7
      pyweb/mumble/MumbleCtlIce.py
  3. 6
      pyweb/mumble/models.py

2
pyweb/mumble/MumbleCtlDbus.py

@ -317,6 +317,8 @@ class MumbleCtlDbus_118(MumbleCtlBase):
ret = int(data) ret = int(data)
return ret return ret
def getUptime(self, srvid):
return None
class MumbleCtlDbus_Legacy( MumbleCtlDbus_118 ): class MumbleCtlDbus_Legacy( MumbleCtlDbus_118 ):
def getVersion( self ): def getVersion( self ):

7
pyweb/mumble/MumbleCtlIce.py

@ -427,7 +427,8 @@ class MumbleCtlIce_118(MumbleCtlBase):
return ret return ret
def getUptime(self, srvid):
return None
class MumbleCtlIce_120(MumbleCtlIce_118): class MumbleCtlIce_120(MumbleCtlIce_118):
@ -569,6 +570,10 @@ class MumbleCtlIce_120(MumbleCtlIce_118):
def kickUser(self, srvid, userid, reason=""): def kickUser(self, srvid, userid, reason=""):
return self._getIceServerObject(srvid).kickUser( userid, reason.encode("UTF-8") ) return self._getIceServerObject(srvid).kickUser( userid, reason.encode("UTF-8") )
@protectDjangoErrPage
def getUptime(self, srvid):
return self._getIceServerObject(srvid).getUptime()
class MumbleCtlIce_122(MumbleCtlIce_120): class MumbleCtlIce_122(MumbleCtlIce_120):
@protectDjangoErrPage @protectDjangoErrPage

6
pyweb/mumble/models.py

@ -315,6 +315,8 @@ class Mumble( models.Model ):
channel_cnt = property( lambda self: len(self.ctl.getChannels(self.srvid)), doc="Number of channels." ) channel_cnt = property( lambda self: len(self.ctl.getChannels(self.srvid)), doc="Number of channels." )
is_public = property( lambda self: not self.passwd, is_public = property( lambda self: not self.passwd,
doc="False if a password is needed to join this server." ) doc="False if a password is needed to join this server." )
uptime = property( lambda self: self.ctl.getUptime(self.srvid),
doc="Number of seconds this instance has been running." )
is_server = True is_server = True
is_channel = False is_channel = False
@ -552,7 +554,8 @@ class Mumble( models.Model ):
return { 'name': self.name, return { 'name': self.name,
'id': self.id, 'id': self.id,
'root': self.rootchan.asDict( authed ), 'root': self.rootchan.asDict( authed ),
'x-connecturl': self.connecturl
'x-connecturl': self.connecturl,
'x-uptime': self.uptime,
} }
def asXml( self, authed=False ): def asXml( self, authed=False ):
@ -562,6 +565,7 @@ class Mumble( models.Model ):
id=unicode(self.id), name=self.name id=unicode(self.id), name=self.name
) )
root.set( 'x-connecturl', self.connecturl ) root.set( 'x-connecturl', self.connecturl )
root.set( 'x-uptime', unicode(self.uptime) )
root.set( 'xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance" ) root.set( 'xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance" )
root.set( 'xsi:schemaLocation', root.set( 'xsi:schemaLocation',
"http://bitbucket.org/Svedrin/mumble-django/wiki/channel-viewer-protocol_murmur-%d-%d-%d.xsd" % self.version[:3] "http://bitbucket.org/Svedrin/mumble-django/wiki/channel-viewer-protocol_murmur-%d-%d-%d.xsd" % self.version[:3]

Loading…
Cancel
Save