From fab9cf879aaf519463fef06184d1b62a29661bd1 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 25 Jan 2009 15:49:52 +0100 Subject: [PATCH] Now the links in the channel viewer work correctly --- pyweb/mumble/admin.py | 2 +- pyweb/mumble/mmobjects.py | 25 +++++++++++++++++++++++-- pyweb/mumble/models.py | 2 +- pyweb/mumble/views.py | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/pyweb/mumble/admin.py b/pyweb/mumble/admin.py index aa56d56..1b3179f 100644 --- a/pyweb/mumble/admin.py +++ b/pyweb/mumble/admin.py @@ -1,6 +1,6 @@ """ This file is part of the mumble-django application. - Copyright (C) 2009, Michael Svedrin Ziegler + Copyright (C) 2009, Michael "Svedrin" Ziegler All rights reserved. diff --git a/pyweb/mumble/mmobjects.py b/pyweb/mumble/mmobjects.py index accaad0..efff664 100644 --- a/pyweb/mumble/mmobjects.py +++ b/pyweb/mumble/mmobjects.py @@ -1,6 +1,6 @@ """ This file is part of the mumble-django application. - Copyright (C) 2009, Michael Svedrin Ziegler + Copyright (C) 2009, Michael "Svedrin" Ziegler All rights reserved. @@ -94,6 +94,13 @@ class mmServer( object ): None ); + def is_server( self ): + return True; + def is_channel( self ): + return False; + def is_player( self ): + return False; + def __str__( self ): return '' % ( self.rootName, self.id ); @@ -127,10 +134,17 @@ class mmChannel( object ): self.parent.subchans.append( 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 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( lambda self: len( self.players ) + sum( [ chan.playerCount for chan in self.subchans ] ), None @@ -175,6 +189,13 @@ class mmPlayer( object ): def isAuthed( self ): 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) playerCount = property( lambda self: -1, diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index 15e4524..35c4be0 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -1,6 +1,6 @@ """ This file is part of the mumble-django application. - Copyright (C) 2009, Michael Svedrin Ziegler + Copyright (C) 2009, Michael "Svedrin" Ziegler All rights reserved. diff --git a/pyweb/mumble/views.py b/pyweb/mumble/views.py index 0b65aee..d1fa015 100644 --- a/pyweb/mumble/views.py +++ b/pyweb/mumble/views.py @@ -1,6 +1,6 @@ """ This file is part of the mumble-django application. - Copyright (C) 2009, Michael Svedrin Ziegler + Copyright (C) 2009, Michael "Svedrin" Ziegler All rights reserved.