Browse Source

check channel names before adding/renaming channels. fixes #149

Natenom/support-murmur-13-1446181288462
Michael Ziegler 14 years ago
parent
commit
bff97a817a
  1. 12
      pyweb/mumble/media/js/channelviewerplugins.js
  2. 6
      pyweb/mumble/models.py

12
pyweb/mumble/media/js/channelviewerplugins.js

@ -254,7 +254,11 @@ Ext.ux.MumbleChannelEditor = Ext.extend( Ext.Component, {
handler: function(btn){ handler: function(btn){
Ext.Msg.prompt(gettext('Name'), gettext('Please enter the channel name:'), function(btn, text){ Ext.Msg.prompt(gettext('Name'), gettext('Please enter the channel name:'), function(btn, text){
if (btn == 'ok'){ if (btn == 'ok'){
Mumble.addChannel( this.serverid, text, this.chandata.id );
Mumble.addChannel( this.serverid, text, this.chandata.id, function(provider, response){
if( response.type == "exception" ){
Ext.Msg.alert( gettext("Error"), response.message );
}
});
} }
}, this); }, this);
} }
@ -263,7 +267,11 @@ Ext.ux.MumbleChannelEditor = Ext.extend( Ext.Component, {
text: gettext("Submit name/description"), text: gettext("Submit name/description"),
handler: function(btn){ handler: function(btn){
f = btn.ownerCt.ownerCt.getForm().getValues(); f = btn.ownerCt.ownerCt.getForm().getValues();
Mumble.renameChannel(this.serverid, this.chandata.id, f.name, f.description);
Mumble.renameChannel(this.serverid, this.chandata.id, f.name, f.description, function(provider, response){
if( response.type == "exception" ){
Ext.Msg.alert( gettext("Error"), response.message );
}
});
} }
}, { }, {
text: gettext('Delete channel'), text: gettext('Delete channel'),

6
pyweb/mumble/models.py

@ -613,12 +613,18 @@ class Mumble( models.Model ):
return self.ctl.setTexture( self.srvid, userid, image ) return self.ctl.setTexture( self.srvid, userid, image )
def addChannel( self, name, parentid ): def addChannel( self, name, parentid ):
regex = (self.channel or self.server.getDefaultConf()['channelname'])
if regex and not re.match( regex, name ):
raise NameError(_("That name is forbidden by the server."))
return self.ctl.addChannel( self.srvid, name, parentid ) return self.ctl.addChannel( self.srvid, name, parentid )
def removeChannel( self, channelid ): def removeChannel( self, channelid ):
return self.ctl.removeChannel( self.srvid, channelid ) return self.ctl.removeChannel( self.srvid, channelid )
def renameChannel( self, channelid, name, description ): def renameChannel( self, channelid, name, description ):
regex = (self.channel or self.server.getDefaultConf()['channelname'])
if regex and not re.match( regex, name ):
raise NameError(_("That name is forbidden by the server."))
return self.ctl.renameChannel( self.srvid, channelid, name, description ) return self.ctl.renameChannel( self.srvid, channelid, name, description )
def moveChannel( self, channelid, parentid ): def moveChannel( self, channelid, parentid ):

Loading…
Cancel
Save