Skip to content

Commit

Permalink
Modified: Change Chatserver trigger to the OPAC Template
Browse files Browse the repository at this point in the history
  • Loading branch information
mucill committed Jun 7, 2015
1 parent 71ae0df commit f437ec2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion admin/admin_template/default/index_template.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
</aside>

<script>
$.get('../chatserver.php', {}, function(){});
var Server;
function log( text ) {
$log = $('#log');
Expand Down
10 changes: 5 additions & 5 deletions chatserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function wsOnMessage($clientID, $message, $messageLength, $binary) {

//The speaker is the only person in the room. Don't let them feel lonely.
if ( sizeof($Server->wsClients) == 1 )
$Server->wsSend($clientID, "There isn't anyone else in the room, but I'll still listen to you. --Your Trusty Server");
$Server->wsSend($clientID, __("There isn't anyone else in the room."));
else
//Send the message to everyone but the person who said it
foreach ( $Server->wsClients as $id => $client )
Expand All @@ -39,24 +39,24 @@ function wsOnOpen($clientID)
global $Server;
$ip = long2ip( $Server->wsClients[$clientID][6] );

$Server->log("Someone has connected." );
$Server->log( _("Someone has connected.") );

//Send a join notice to everyone but the person who joined
foreach ( $Server->wsClients as $id => $client )
if ( $id != $clientID )
$Server->wsSend($id, "Someone has joined the room.");
$Server->wsSend($id, _("Someone has joined the room."));
}

// when a client closes or lost connection
function wsOnClose($clientID, $status) {
global $Server;
$ip = long2ip( $Server->wsClients[$clientID][6] );

$Server->log( "Someone has disconnected." );
$Server->log( _("Someone has disconnected.") );

//Send a user left notice to everyone in the room
foreach ( $Server->wsClients as $id => $client )
$Server->wsSend($id, "Someone has left the room.");
$Server->wsSend($id, _("Someone has left the room."));
}

// start the server
Expand Down
1 change: 1 addition & 0 deletions template/default/index_template.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
</aside>

<script>
$.get('chatserver.php', {}, function(){});
var Server;
function log( text ) {
$log = $('#log');
Expand Down

0 comments on commit f437ec2

Please sign in to comment.