MuteList
From OpenSimulator
(Difference between revisions)
(→Mutelist Source Code) |
(→mutelist.php) |
||
(One intermediate revision by one user not shown) | |||
Line 2: | Line 2: | ||
<div style="background-color:#FFA0A0; padding:10px; padding-bottom:5px; border: 1px #FF544F solid"> | <div style="background-color:#FFA0A0; padding:10px; padding-bottom:5px; border: 1px #FF544F solid"> | ||
− | '''Caution !''' Valid with MuteList | + | '''Caution !''' Valid with MuteList Add-on and OpenSimulator v0.9.0. For OpenSim v0.9.1, MuteList is a Core module. |
</div> | </div> | ||
<br /> | <br /> | ||
Line 156: | Line 156: | ||
$flags = $req['flags']; | $flags = $req['flags']; | ||
$query = $db->prepare("INSERT INTO mutelist VALUES (?, ?, ?, ?, ?, NOW())"); | $query = $db->prepare("INSERT INTO mutelist VALUES (?, ?, ?, ?, ?, NOW())"); | ||
− | $result = $query->execute( | + | $result = $query->execute(array($avatarUUID, $muteUUID, $name, $type, $flags) ); |
− | + | ||
$response_xml = xmlrpc_encode(array( | $response_xml = xmlrpc_encode(array( | ||
'success' => $result, | 'success' => $result, | ||
Line 174: | Line 173: | ||
$avatarUUID = $req['avataruuid']; | $avatarUUID = $req['avataruuid']; | ||
$muteUUID = $req['muteuuid']; | $muteUUID = $req['muteuuid']; | ||
− | $query = $db->prepare("DELETE FROM mutelist WHERE" . | + | $query = $db->prepare("DELETE FROM mutelist WHERE "." AgentID = ? AND MuteID = ?"); |
− | + | ||
$result = $query->execute( array($avatarUUID, $muteUUID) ); | $result = $query->execute( array($avatarUUID, $muteUUID) ); | ||
$response_xml = xmlrpc_encode(array( | $response_xml = xmlrpc_encode(array( |
Latest revision as of 11:10, 11 May 2018
Caution ! Valid with MuteList Add-on and OpenSimulator v0.9.0. For OpenSim v0.9.1, MuteList is a Core module.
Contents |
[edit] Mutelist Overview
OpenSimMutelist add-on module for OpenSimulator
[edit] What is "Mutelist" in OpenSimulator?
Mutelist is ...
[edit] How it works?
Coming soon ...
[edit] Compiling the module
Coming soon ...
[edit] First time installation and configuration
Coming soon ...
[edit] Mutelist Table Structure
Field | Type | Collation | Attributes | Null | Default | Extra |
---|---|---|---|---|---|---|
AgentID | char(36) | utf8_unicode_ci | NOT NULL | |||
MuteID | char(36) | utf8_unicode_ci | NOT NULL | |||
MuteName | varchar(255) | utf8_unicode_ci | NOT NULL | |||
type | int(11) | utf8_unicode_ci | UNSIGNED | NOT NULL | ||
flags | int(11) | utf8_unicode_ci | UNSIGNED | NOT NULL | ||
Stamp | timestamp | utf8_unicode_ci | DEFAULT | NOT NULL | CURRENT_TIMESTAMP |
[edit] Mutelist Table Fields
- AgentID
- The UUID of ...
- MuteID
- The UUID of ...
- MuteName
- The Name of ...
- type
- The type of ...
- flags
- The flags of ...
- Stamp
- The Stamp of ...
[edit] mutelist.sql
CREATE TABLE IF NOT EXISTS `mutelist` ( `AgentID` char(36) COLLATE utf8_unicode_ci NOT NULL, `MuteID` char(36) COLLATE utf8_unicode_ci NOT NULL, `MuteName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `type` int(11) UNSIGNED NOT NULL, `flags` int(11) UNSIGNED NOT NULL, `Stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`) USING BTREE, KEY `AgentID` (`AgentID`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
[edit] databaseinfo.php
<?php $DB_HOST = "localhost"; $DB_USER = "root"; $DB_PASSWORD = ""; $DB_NAME = "osmodules"; ?>
[edit] mutelist.php
<?php include("databaseinfo.php"); // Attempt to connect to the database with the mutelist table try { $db = new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASSWORD); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { echo "Error connecting to the database with the mutelist table\n"; file_put_contents('PDOErrors.txt', $e->getMessage() . "\n-----\n", FILE_APPEND); exit; } ###################### No user serviceable parts below ##################### function get_error_message($result) { global $db; if (!$result) return ""; $errorInfo = $db->errorInfo(); return $errorInfo[2]; } # # The XMLRPC server object # $xmlrpc_server = xmlrpc_server_create(); # # Return list of muted agents and objects # xmlrpc_server_register_method($xmlrpc_server, "mutelist_request", "mutelist_request"); function mutelist_request($method_name, $params, $app_data) { global $db; $req = $params[0]; $avatarUUID = $req['avataruuid']; $query = $db->prepare("SELECT * FROM mutelist WHERE AgentID = ?"); $result = $query->execute( array($avatarUUID) ); $mutelist = ""; if ($query->rowCount() > 0) { while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $mutelist .= $row["type"] . " "; $mutelist .= $row["MuteID"] . " "; $mutelist .= $row["MuteName"] . "|"; $mutelist .= $row["flags"] . "\n"; } } $response_xml = xmlrpc_encode(array( 'success' => $result, 'errorMessage' => get_error_message($result), 'mutelist' => $mutelist )); print $response_xml; } # # Remove an event notify reminder request # xmlrpc_server_register_method($xmlrpc_server, "mutelist_update", "mutelist_update"); function mutelist_update($method_name, $params, $app_data) { global $db; $req = $params[0]; $avatarUUID = $req['avataruuid']; $muteUUID = $req['muteuuid']; $name = $req['name']; $type = $req['type']; $flags = $req['flags']; $query = $db->prepare("INSERT INTO mutelist VALUES (?, ?, ?, ?, ?, NOW())"); $result = $query->execute(array($avatarUUID, $muteUUID, $name, $type, $flags) ); $response_xml = xmlrpc_encode(array( 'success' => $result, 'errorMessage' => get_error_message($result) )); print $response_xml; } # # Remove an event notify reminder request # xmlrpc_server_register_method($xmlrpc_server, "mutelist_remove", "mutelist_remove"); function mutelist_remove($method_name, $params, $app_data) { global $db; $req = $params[0]; $avatarUUID = $req['avataruuid']; $muteUUID = $req['muteuuid']; $query = $db->prepare("DELETE FROM mutelist WHERE "." AgentID = ? AND MuteID = ?"); $result = $query->execute( array($avatarUUID, $muteUUID) ); $response_xml = xmlrpc_encode(array( 'success' => $result, 'errorMessage' => get_error_message($result) )); print $response_xml; } # # Process the request # $request_xml = file_get_contents("php://input"); xmlrpc_server_call_method($xmlrpc_server, $request_xml, ''); xmlrpc_server_destroy($xmlrpc_server); ?>
[edit] Mutelist Add-on Module Source Code
OpenSim Mutelist source code is available on github @ OpenSimMutelist