Skip to content
Permalink
Browse files

Small fixes and improvements.

  • Loading branch information...
defacer
defacer committed Aug 26, 2004
1 parent ebc9be8 commit ca27c7f7348e7ac716fbd795480360b4d535effa
Showing with 17 additions and 13 deletions.
  1. +7 −5 mod/chat/chatd.php
  2. +10 −8 mod/chat/gui_sockets/chatinput.php
@@ -99,8 +99,10 @@ function ChatDaemon() {
}
function error_handler ($errno, $errmsg, $filename, $linenum, $vars) {
echo $errno;
$this->trace($errmsg.' on line '.$linenum, $errno);
// Checks if an error needs to be suppressed due to @
if(error_reporting() != 0) {
$this->trace($errmsg.' on line '.$linenum, $errno);
}
return true;
}
@@ -758,7 +760,7 @@ function init_sockets() {
if(false === ($this->listen_socket = socket_create(AF_INET, SOCK_STREAM, 0))) {
// Failed to create socket
$lasterr = socket_last_error();
$this->fatal('Error: socket_create() failed: '. socket_strerror($lasterr).' ['.$lasterr.']');
$this->fatal('socket_create() failed: '. socket_strerror($lasterr).' ['.$lasterr.']');
}
//socket_close($DAEMON->listen_socket);
@@ -767,13 +769,13 @@ function init_sockets() {
if(!socket_bind($this->listen_socket, $CFG->chat_serverip, $CFG->chat_serverport)) {
// Failed to bind socket
$lasterr = socket_last_error();
$this->fatal('Error: socket_bind() failed: '. socket_strerror($lasterr).' ['.$lasterr.']');
$this->fatal('socket_bind() failed: '. socket_strerror($lasterr).' ['.$lasterr.']');
}
if(!socket_listen($this->listen_socket, $CFG->chat_servermax)) {
// Failed to get socket to listen
$lasterr = socket_last_error();
$this->fatal('Error: socket_listen() failed: '. socket_strerror($lasterr).' ['.$lasterr.']');
$this->fatal('socket_listen() failed: '. socket_strerror($lasterr).' ['.$lasterr.']');
}
// Socket has been initialized and is ready
@@ -32,44 +32,46 @@
scroll_active = true;
function empty_field_and_submit() {
cf = document.getElementById('chatform');
var cf = document.getElementById('sendform');
var inpf = document.getElementById('inputform');
cf.chat_msgidnr.value = parseInt(cf.chat_msgidnr.value) + 1;
cf.chat_message.value = document.f.chat_message.value;
cf.chat_message.value = inpf.chat_message.value;
cf.submit();
document.f.chat_message.value='';
document.f.chat_message.focus();
inpf.chat_message.value='';
inpf.chat_message.focus();
return false;
}
function prepareusers() {
var frm = window.parent.frames;
for(i = 0; i < frm.length; ++i) {
if(frm(i).name == "users") {
window.userFrame = frm(i);
window.userHREF = frm(i).location.href;
window.setTimeout("reloadusers();", <?php echo $CFG->chat_refresh_userlist; ?> * 1000);
}
}
}
function reloadusers() {
if(window.userFrame) {
window.userFrame.location.reload();
window.userFrame.location.href = window.userFrame.location.href;
window.setTimeout("reloadusers();", <?php echo $CFG->chat_refresh_userlist; ?> * 1000);
}
}
// -->
</script>
</head>

<body bgcolor="<?php echo $THEME->body ?>" onload="document.f.chat_message.focus();document.f.chat_message.select(); prepareusers();">
<body bgcolor="<?php echo $THEME->body ?>" onload="document.getElementById('inputform').chat_message.focus();document.getElementById('inputform').chat_message.select(); prepareusers();">

<!--
<form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport"; ?>" method="GET" target="empty" name="f" onsubmit="return empty_field_and_submit()">
-->
<form action="../insert.php" method="get" target="empty" name="f" onsubmit="return empty_field_and_submit()">
<form action="../insert.php" method="get" target="empty" id="inputform" onsubmit="return empty_field_and_submit();">
&gt;&gt; <input type="text" name="chat_message" size="60" value="<?php echo $chat_pretext; ?>">
<?php helpbutton("chatting", get_string("helpchatting", "chat"), "chat", true, false); ?>
</form>

<form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="chatform">
<form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform">
<input type="hidden" name="win" value="message" />
<input type="hidden" name="chat_version" value="sockets" />
<input type="hidden" name="chat_message" value="" />

0 comments on commit ca27c7f

Please sign in to comment.
You can’t perform that action at this time.