|
@ -1,6 +1,6 @@ |
|
|
""" This file is part of the mumble-django application. |
|
|
""" This file is part of the mumble-django application. |
|
|
|
|
|
|
|
|
Copyright (C) 2009, Michael Svedrin Ziegler <diese-addy@funzt-halt.net> |
|
|
|
|
|
|
|
|
Copyright (C) 2009, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net> |
|
|
|
|
|
|
|
|
All rights reserved. |
|
|
All rights reserved. |
|
|
|
|
|
|
|
@ -94,6 +94,13 @@ class mmServer( object ): |
|
|
None |
|
|
None |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
def is_server( self ): |
|
|
|
|
|
return True; |
|
|
|
|
|
def is_channel( self ): |
|
|
|
|
|
return False; |
|
|
|
|
|
def is_player( self ): |
|
|
|
|
|
return False; |
|
|
|
|
|
|
|
|
def __str__( self ): |
|
|
def __str__( self ): |
|
|
return '<Server "%s" (%d)>' % ( self.rootName, self.id ); |
|
|
return '<Server "%s" (%d)>' % ( self.rootName, self.id ); |
|
|
|
|
|
|
|
@ -127,10 +134,17 @@ class mmChannel( object ): |
|
|
self.parent.subchans.append( self ); |
|
|
self.parent.subchans.append( self ); |
|
|
|
|
|
|
|
|
def parentChannels( self ): |
|
|
def parentChannels( self ): |
|
|
if self.parent is None or isinstance( self.parent, mmServer ): |
|
|
|
|
|
|
|
|
if self.parent is None or self.parent.is_server() or self.parent.id == 0: |
|
|
return []; |
|
|
return []; |
|
|
return self.parent.parentChannels() + [self.parent.name]; |
|
|
return self.parent.parentChannels() + [self.parent.name]; |
|
|
|
|
|
|
|
|
|
|
|
def is_server( self ): |
|
|
|
|
|
return False; |
|
|
|
|
|
def is_channel( self ): |
|
|
|
|
|
return True; |
|
|
|
|
|
def is_player( self ): |
|
|
|
|
|
return False; |
|
|
|
|
|
|
|
|
playerCount = property( |
|
|
playerCount = property( |
|
|
lambda self: len( self.players ) + sum( [ chan.playerCount for chan in self.subchans ] ), |
|
|
lambda self: len( self.players ) + sum( [ chan.playerCount for chan in self.subchans ] ), |
|
|
None |
|
|
None |
|
@ -175,6 +189,13 @@ class mmPlayer( object ): |
|
|
def isAuthed( self ): |
|
|
def isAuthed( self ): |
|
|
return self.dbaseid != -1; |
|
|
return self.dbaseid != -1; |
|
|
|
|
|
|
|
|
|
|
|
def is_server( self ): |
|
|
|
|
|
return False; |
|
|
|
|
|
def is_channel( self ): |
|
|
|
|
|
return False; |
|
|
|
|
|
def is_player( self ): |
|
|
|
|
|
return True; |
|
|
|
|
|
|
|
|
# kept for compatibility to mmChannel (useful for traversal funcs) |
|
|
# kept for compatibility to mmChannel (useful for traversal funcs) |
|
|
playerCount = property( |
|
|
playerCount = property( |
|
|
lambda self: -1, |
|
|
lambda self: -1, |
|
|