Add 'allowurlname' setting for 'chat' - permits web name set with playername= parameter

This commit is contained in:
Mike Primm 2011-12-23 00:50:41 +08:00 committed by mikeprimm
parent 756202affd
commit 44106a799a
2 changed files with 8 additions and 1 deletions

View file

@ -17,11 +17,16 @@ componentconstructors['chat'] = function(dynmap, configuration) {
}
});
});
var pname = null;
if(configuration.allowurlname) {
pname = dynmap.getParameterByName("playername");
if(pname == "") pname = null;
}
if (dynmap.options.allowwebchat) {
// Accepts 'sendchat'-events to send chat messages to the server.
$(dynmap).bind('sendchat', function(event, message) {
var data = '{"name":'+JSON.stringify(ip?ip:"")+',"message":'+JSON.stringify(message)+'}';
var data = '{"name":'+JSON.stringify(pname?pname:(ip?ip:""))+',"message":'+JSON.stringify(message)+'}';
$.ajax({
type: 'POST',
url: config.url.sendmessage,