Fixed a bug that caused the webclient input line to suddenly reset every three minutes. Thanks to use "lusid" for supplying the hint on fixing this one! Also added a more consistent way of parsing the incoming address.
This commit is contained in:
parent
ca32950d90
commit
4b56d5a3a4
2 changed files with 16 additions and 10 deletions
|
|
@ -272,7 +272,10 @@ class ServerSession(Session):
|
|||
if self.logged_in and hasattr(self, "player") and self.player:
|
||||
symbol = "(#%s)" % self.player.id
|
||||
try:
|
||||
if hasattr(self.address, '__iter__'):
|
||||
address = ":".join([str(part) for part in self.address])
|
||||
else:
|
||||
address = self.address
|
||||
except Exception:
|
||||
address = self.address
|
||||
return "%s%s@%s" % (self.uname, symbol, address)
|
||||
|
|
|
|||
|
|
@ -105,8 +105,9 @@ function webclient_receive(){
|
|||
});
|
||||
};
|
||||
|
||||
function webclient_input(arg){
|
||||
function webclient_input(arg, no_update){
|
||||
// Send an input from the player to the server
|
||||
// no_update is used for sending idle messages behind the scenes.
|
||||
|
||||
var outmsg = typeof(arg) != 'undefined' ? arg : $("#inputfield").val();
|
||||
|
||||
|
|
@ -122,9 +123,11 @@ function webclient_input(arg){
|
|||
|
||||
success: function(data){
|
||||
//if (outmsg.length > 0 ) msg_display("inp", outmsg) // echo input on command line
|
||||
if (no_update == undefined) {
|
||||
history_add(outmsg);
|
||||
HISTORY_POS = 0;
|
||||
$('#inputform')[0].reset(); // clear input field
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown){
|
||||
msg_display("err", "Error: Server returned an error or timed out. Try resending or reloading the page.");
|
||||
|
|
@ -284,7 +287,7 @@ $(document).ready(function(){
|
|||
}, 500);
|
||||
// set an idle timer to avoid proxy servers to time out on us (every 3 minutes)
|
||||
setInterval(function() {
|
||||
webclient_input("idle");
|
||||
webclient_input("idle", true);
|
||||
}, 60000*3);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue