Offline Messaging
From OpenSimulator
(Difference between revisions)
m (→Through PHP module) |
m (Robot: Cosmetic changes) |
||
Line 4: | Line 4: | ||
− | Offline messaging makes it possible to send IM's to people that are not online and saves the messages directly to a database.<br> | + | Offline messaging makes it possible to send IM's to people that are not online and saves the messages directly to a database.<br /> |
− | <b>Please note that these are third party modules which you use at your own risk!<br> | + | <b>Please note that these are third party modules which you use at your own risk!<br /> |
OpenSimulator takes no responsibility for these modules.</b> | OpenSimulator takes no responsibility for these modules.</b> | ||
Line 12: | Line 12: | ||
In the latest version offline module is already ready to be used | In the latest version offline module is already ready to be used | ||
* Install the Offline_IM.sql file on your database [http://www.apachefriends.org xampp] | * Install the Offline_IM.sql file on your database [http://www.apachefriends.org xampp] | ||
− | * Enable the Offline Messaging Module in your Opensim.ini file.<br> | + | * Enable the Offline Messaging Module in your Opensim.ini file.<br /> |
− | * Upload the offline.php to your web server | + | * Upload the offline.php to your web server [http://www.apachefriends.org xampp] |
=== Changes in the OpenSim.ini file === | === Changes in the OpenSim.ini file === | ||
Line 36: | Line 36: | ||
P.D: The MuteListModule and URL must be uncommented in order for the offline module to work, even if there is no mute.php file in the web folder. | P.D: The MuteListModule and URL must be uncommented in order for the offline module to work, even if there is no mute.php file in the web folder. | ||
− | === SQL file to load (Offline_IM.txt)=== | + | === SQL file to load (Offline_IM.txt) === |
<source lang=text> | <source lang=text> | ||
Line 47: | Line 47: | ||
</source > | </source > | ||
− | === PHP for web server (offline.php)=== | + | === PHP for web server (offline.php) === |
<source lang=text> | <source lang=text> | ||
<?php | <?php |
Revision as of 19:42, 3 March 2012
Offline messaging makes it possible to send IM's to people that are not online and saves the messages directly to a database.
Please note that these are third party modules which you use at your own risk!
OpenSimulator takes no responsibility for these modules.
Through PHP module
In the latest version offline module is already ready to be used
- Install the Offline_IM.sql file on your database xampp
- Enable the Offline Messaging Module in your Opensim.ini file.
- Upload the offline.php to your web server xampp
Changes in the OpenSim.ini file
[Messaging] ; Control which region module is used for instant messaging. ; Default is InstantMessageModule (this is the name of the core IM module as well as the setting) InstantMessageModule = InstantMessageModule ; MessageTransferModule = MessageTransferModule OfflineMessageModule = OfflineMessageModule OfflineMessageURL = http://yourserver/offline.php MuteListModule = MuteListModule MuteListURL = http://yourserver/mute.php ForwardOfflineGroupMessages = true
When you did it right, reboot your region and try to send a message to an offline person. Check the database to see that it has written a record.
Next time that person logs in, he will get the message and the database will be updated
P.D: The MuteListModule and URL must be uncommented in order for the offline module to work, even if there is no mute.php file in the web folder.
SQL file to load (Offline_IM.txt)
CREATE TABLE IF NOT EXISTS `Offline_IM` ( `uuid` varchar(36) NOT NULL, `message` text NOT NULL, KEY `uuid` (`uuid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
PHP for web server (offline.php)
<?php $dbName = "comunity"; $dbHost = "localhost"; $dbUser = "root"; $dbPassword =""; define("C_DB_TYPE","mysql"); define("C_DB_HOST",$dbHost); define("C_DB_NAME",$dbName); define("C_DB_USER",$dbUser); define("C_DB_PASS",$dbPassword); define("C_OFFLINE_IM_TBL", "Offline_IM"); include("mysql.php"); $DbLink = new DB; $method = $_SERVER["PATH_INFO"]; if ($method == "/SaveMessage/") { $msg = $HTTP_RAW_POST_DATA; $start = strpos($msg, "?>"); if ($start != -1) { $start+=2; $msg = substr($msg, $start); $parts = split("[<>]", $msg); $to_agent = $parts[12]; $DbLink->query("insert into ".C_OFFLINE_IM_TBL." (uuid, message) values ('" . mysql_escape_string($to_agent) . "', '" . mysql_escape_string($msg) . "')"); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><boolean>true</boolean>"; } else { echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><boolean>false</boolean>"; } exit; } if ($method == "/RetrieveMessages/") { $parms = $HTTP_RAW_POST_DATA; $parts = split("[<>]", $parms); $agent_id = $parts[6]; $DbLink->query("select message from ".C_OFFLINE_IM_TBL." where uuid='" . mysql_escape_string($agent_id) . "'"); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><ArrayOfGridInstantMessage xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"; while(list($message) = $DbLink->next_record()) { echo $message; } echo "</ArrayOfGridInstantMessage>"; $DbLink->query("delete from ".C_OFFLINE_IM_TBL." where uuid='" . mysql_escape_string($agent_id) . "'"); exit; } ?>