Browse Source

implemented sorted channel list

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
75f30b0c84
  1. 11
      pyweb/mumble/mmobjects.py
  2. 2
      pyweb/mumble/models.py

11
pyweb/mumble/mmobjects.py

@ -23,6 +23,10 @@ from os.path import join
from django.utils.http import urlquote
def cmp_names( a, b ):
return cmp( a.name, b.name );
class mmChannel( object ):
# channels = list();
# subchans = list();
@ -68,6 +72,13 @@ class mmChannel( object ):
def __str__( self ):
return '<Channel "%s" (%d)>' % ( self.name, self.chanid );
def sort( self ):
# Sort my subchannels and players, and then iterate over them and sort them recursively
self.subchans.sort( cmp_names );
self.players.sort( cmp_names );
for sc in self.subchans:
sc.sort();
def visit( self, callback, lvl = 0 ):
# call callback on myself, then visit my subchans, then my players
callback( self, lvl );

2
pyweb/mumble/models.py

@ -197,6 +197,8 @@ class Mumble( models.Model ):
for thePlayer in self.ctl.getPlayers(self.srvid):
# Players - Fields: 0 = UserID, 6 = ChannelID
self.players[ thePlayer[0] ] = mmPlayer( self, thePlayer, self._channels[ thePlayer[6] ] );
self._channels[0].sort();
return self._channels;

Loading…
Cancel
Save