mirror of
https://github.com/ManfredAabye/opensimcurrencyserver-dotnet.git
synced 2026-08-14 00:57:56 +00:00
06112024
This commit is contained in:
+10
-4
@@ -23,6 +23,7 @@ using System.Text.RegularExpressions;
|
||||
using log4net;
|
||||
using MySql.Data.MySqlClient;
|
||||
using OpenMetaverse;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenSim.Data.MySQL.MySQLMoneyDataWrapper
|
||||
{
|
||||
@@ -50,11 +51,16 @@ namespace OpenSim.Data.MySQL.MySQLMoneyDataWrapper
|
||||
/// <param name="port">The port.</param>
|
||||
public MySQLMoneyManager(string hostname, string database, string username, string password, string cpooling, string port)
|
||||
{
|
||||
string s = "Server=" + hostname + ";Port=" + port + ";Database=" + database +
|
||||
";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";";
|
||||
Initialise(s);
|
||||
}
|
||||
var requiredParameters = new[] { hostname, database, username, password, cpooling, port };
|
||||
|
||||
if (requiredParameters.Any(p => string.IsNullOrEmpty(p)))
|
||||
{
|
||||
throw new ArgumentException("All connection parameters must be provided.");
|
||||
}
|
||||
|
||||
string connectionString = $"Server={hostname};Port={port};Database={database};User ID={username};Password={password};Pooling={cpooling};";
|
||||
Initialise(connectionString);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="MySQLMoneyManager" /> class.</summary>
|
||||
/// <param name="connect">The connect.</param>
|
||||
|
||||
@@ -701,10 +701,6 @@ namespace OpenSim.Grid.MoneyServer
|
||||
|
||||
// Test 2024
|
||||
|
||||
public bool UserExists_old(string userID)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public bool UserExists(string userID)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
@@ -729,11 +725,6 @@ namespace OpenSim.Grid.MoneyServer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool UpdateUserInfo_old(string userID, UserInfo updatedInfo)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public bool UpdateUserInfo(string userID, UserInfo updatedInfo)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
@@ -758,10 +749,6 @@ namespace OpenSim.Grid.MoneyServer
|
||||
}
|
||||
}
|
||||
|
||||
public bool DeleteUser_old(string userID)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public bool DeleteUser(string userID)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
@@ -786,19 +773,11 @@ namespace OpenSim.Grid.MoneyServer
|
||||
}
|
||||
}
|
||||
|
||||
public void LogTransactionError_old(UUID transactionID, string errorMessage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void LogTransactionError(UUID transactionID, string errorMessage)
|
||||
{
|
||||
m_log.ErrorFormat("[MONEY DB]: Transaction {0} failed with error: {1}", transactionID, errorMessage);
|
||||
}
|
||||
|
||||
public IEnumerable<TransactionData> GetTransactionHistory_old(string userID, int startTime, int endTime)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public IEnumerable<TransactionData> GetTransactionHistory(string userID, int startTime, int endTime)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
@@ -70,15 +70,21 @@ namespace OpenSim.Grid.MoneyServer
|
||||
IConfig m_server_config;
|
||||
IConfig m_cert_config;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Money Server Base
|
||||
/// Initializes a new instance of the MoneyServerBase class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This constructor initializes the MoneyServerBase object and sets up the console and logging.
|
||||
/// </remarks>
|
||||
public MoneyServerBase()
|
||||
{
|
||||
// Initialize the console for the Money Server
|
||||
m_console = new LocalConsole("MoneyServer ");
|
||||
|
||||
// Set the main console instance to the Money Server console
|
||||
MainConsole.Instance = m_console;
|
||||
//m_log.Info("[MONEY SERVER]: Starting...");
|
||||
|
||||
// Log a message to indicate that the Money Server is initializing
|
||||
m_log.Info("[MONEY SERVER]: Initializing Money Server module and loading configurations...");
|
||||
}
|
||||
|
||||
@@ -94,6 +100,7 @@ namespace OpenSim.Grid.MoneyServer
|
||||
Enabled = true
|
||||
};
|
||||
|
||||
|
||||
// Add event handler to check transactions
|
||||
checkTimer.Elapsed += CheckTransaction;
|
||||
|
||||
@@ -129,10 +136,23 @@ namespace OpenSim.Grid.MoneyServer
|
||||
/// </summary>
|
||||
private void CheckTransaction(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
long ticksToEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks;
|
||||
int unixEpochTime = (int)((DateTime.UtcNow.Ticks - ticksToEpoch) / 10000000);
|
||||
int deadTime = unixEpochTime - DEAD_TIME;
|
||||
m_moneyDBService.SetTransExpired(deadTime);
|
||||
if (m_moneyDBService == null)
|
||||
{
|
||||
m_log.Error("m_moneyDBService is null, cannot check transactions.");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
long ticksToEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks;
|
||||
int unixEpochTime = (int)((DateTime.UtcNow.Ticks - ticksToEpoch) / 10000000);
|
||||
int deadTime = unixEpochTime - DEAD_TIME;
|
||||
m_moneyDBService.SetTransExpired(deadTime);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("Error in CheckTransaction: {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+134
-46
@@ -64,14 +64,8 @@ namespace OpenSim.Grid.MoneyServer
|
||||
|
||||
private string m_sslCommonName = "";
|
||||
|
||||
/// <summary>
|
||||
/// For server authentication
|
||||
/// </summary>
|
||||
private NSLCertificateVerify m_certVerify = new NSLCertificateVerify();
|
||||
|
||||
/// <summary>
|
||||
/// Update Balance Messages
|
||||
/// </summary>
|
||||
private string m_BalanceMessageLandSale = "Paid the Money L${0} for Land.";
|
||||
private string m_BalanceMessageRcvLandSale = "";
|
||||
private string m_BalanceMessageSendGift = "Sent Gift L${0} to {1}.";
|
||||
@@ -246,11 +240,10 @@ namespace OpenSim.Grid.MoneyServer
|
||||
m_httpServer.AddXmlRPCHandler("UserAlert", UserAlertHandler);
|
||||
}
|
||||
|
||||
public void processPHP(IOSHttpRequest request, IOSHttpResponse response)
|
||||
public void processPHP_old(IOSHttpRequest request, IOSHttpResponse response)
|
||||
{
|
||||
m_log.InfoFormat("[MONEY MODULE]: Received request at {0}", request.RawUrl);
|
||||
|
||||
// Logge den XML-RPC-Request in eine Datei
|
||||
LogXmlRpcRequest(request);
|
||||
|
||||
if (m_moneyDBService == null)
|
||||
@@ -272,8 +265,46 @@ namespace OpenSim.Grid.MoneyServer
|
||||
response.RawBuffer = Encoding.UTF8.GetBytes("<response>Error</response>");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Processes a PHP request by handling XML-RPC requests and logging the request.
|
||||
/// </summary>
|
||||
/// <param name="request">The incoming request.</param>
|
||||
/// <param name="response">The outgoing response.</param>
|
||||
public void processPHP(IOSHttpRequest request, IOSHttpResponse response)
|
||||
{
|
||||
// Log the request URL
|
||||
m_log.InfoFormat("[MONEY MODULE]: Received request at {0}", request.RawUrl);
|
||||
|
||||
public XmlRpcResponse OnMoneyTransferedHandler(XmlRpcRequest request, IPEndPoint client)
|
||||
// Log the XML-RPC request
|
||||
LogXmlRpcRequest(request);
|
||||
|
||||
// Check if the database service is initialized
|
||||
if (m_moneyDBService == null)
|
||||
{
|
||||
// Log an error and set the response status code to 500
|
||||
m_log.Error("[MONEY MODULE]: Database service not initialized.");
|
||||
response.StatusCode = 500;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Handle the XML-RPC request
|
||||
MainServer.Instance.HandleXmlRpcRequests((OSHttpRequest)request, (OSHttpResponse)response, m_rpcHandlers);
|
||||
|
||||
// Log a success message
|
||||
m_log.InfoFormat("[MONEY MODULE]: Successfully processed request.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Log an error and set the response status code to 500
|
||||
m_log.ErrorFormat("[MONEY MODULE]: Error processing request: {0}", ex.Message);
|
||||
response.StatusCode = 500; // Internal Server Error
|
||||
response.RawBuffer = Encoding.UTF8.GetBytes("<response>Error</response>");
|
||||
}
|
||||
}
|
||||
|
||||
public XmlRpcResponse OnMoneyTransferedHandler(XmlRpcRequest request, IPEndPoint client)
|
||||
{
|
||||
// Implementiere hier die Logik für den Handler
|
||||
return new XmlRpcResponse(); // add a return statement
|
||||
@@ -327,51 +358,53 @@ namespace OpenSim.Grid.MoneyServer
|
||||
m_log.InfoFormat("[MONEY MODULE]: Registered /currency.php and /landtool.php handlers.");
|
||||
}
|
||||
|
||||
/// <summary>Buys the function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="client">The client.</param>
|
||||
/// <exception cref="System.NotImplementedException"></exception>
|
||||
private XmlRpcResponse buy_func_old(XmlRpcRequest request, IPEndPoint client)
|
||||
{
|
||||
m_log.InfoFormat("[MONEY XMLRPC]: handleClient buyCurrency.");
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>Buys the function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="client">The client.</param>
|
||||
/// <summary>Handles the buy function.</summary>
|
||||
/// <param name="request">The XML-RPC request.</param>
|
||||
/// <param name="client">The client endpoint.</param>
|
||||
/// <returns>An XML-RPC response indicating success.</returns>
|
||||
private XmlRpcResponse buy_func(XmlRpcRequest request, IPEndPoint client)
|
||||
{
|
||||
// Log the XML-RPC request
|
||||
m_log.InfoFormat("[MONEY XMLRPC]: handleClient buyCurrency.");
|
||||
|
||||
// Create the XML-RPC response
|
||||
XmlRpcResponse returnval = new XmlRpcResponse();
|
||||
Hashtable returnresp = new Hashtable();
|
||||
returnresp.Add("success", true);
|
||||
returnval.Value = returnresp;
|
||||
|
||||
// Return the XML-RPC response
|
||||
return returnval;
|
||||
}
|
||||
|
||||
/// <summary>Quotes the function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="client">The client.</param>
|
||||
/// <exception cref="System.NotImplementedException"></exception>
|
||||
private XmlRpcResponse quote_func_old(XmlRpcRequest request, IPEndPoint client)
|
||||
{
|
||||
m_log.InfoFormat("[MONEY XMLRPC]: handleClient getCurrencyQuote.");
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>Quotes the function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="client">The client.</param>
|
||||
/// <summary> Handles the get currency quote request.</summary>
|
||||
/// <param name="request">The incoming XML-RPC request.</param>
|
||||
/// <param name="client">The client that made the request.</param>
|
||||
/// <returns>An XML-RPC response with the currency quote.</returns>
|
||||
private XmlRpcResponse quote_func(XmlRpcRequest request, IPEndPoint client)
|
||||
{
|
||||
// Log the request for auditing purposes
|
||||
m_log.InfoFormat("[MONEY XMLRPC]: handleClient getCurrencyQuote.");
|
||||
|
||||
// Create a response object to store the quote details
|
||||
Hashtable quoteResponse = new Hashtable();
|
||||
quoteResponse.Add("success", true);
|
||||
quoteResponse.Add("currency", new Hashtable()); // Add currency details here
|
||||
quoteResponse.Add("confirm", "asdfad9fj39ma9fj");
|
||||
|
||||
// Set the success flag to true
|
||||
quoteResponse.Add("success", true);
|
||||
|
||||
// Add a placeholder for currency details (to be implemented)
|
||||
quoteResponse.Add("currency", new Hashtable()); // TODO: Add currency details here
|
||||
|
||||
// Add a confirmation code (to be implemented)
|
||||
quoteResponse.Add("confirm", "asdfad9fj39ma9fj"); // TODO: Generate a unique confirmation code
|
||||
|
||||
// Create an XML-RPC response object
|
||||
XmlRpcResponse returnval = new XmlRpcResponse();
|
||||
|
||||
// Set the response value to the quote response object
|
||||
returnval.Value = quoteResponse;
|
||||
|
||||
// Return the response to the client
|
||||
return returnval;
|
||||
}
|
||||
|
||||
@@ -387,7 +420,7 @@ namespace OpenSim.Grid.MoneyServer
|
||||
/// <summary>Lands the buy function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="client">The client.</param>
|
||||
private XmlRpcResponse landBuy_func(XmlRpcRequest request, IPEndPoint client)
|
||||
private XmlRpcResponse landBuy_func_old2(XmlRpcRequest request, IPEndPoint client)
|
||||
{
|
||||
m_log.InfoFormat("[MONEY XMLRPC]: handleClient buyLandPrep.");
|
||||
XmlRpcResponse returnval = new XmlRpcResponse();
|
||||
@@ -396,20 +429,43 @@ namespace OpenSim.Grid.MoneyServer
|
||||
returnval.Value = returnresp;
|
||||
return returnval;
|
||||
}
|
||||
/// <summary>Lands the buy function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="client">The client.</param>
|
||||
private XmlRpcResponse landBuy_func(XmlRpcRequest request, IPEndPoint client)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
m_log.Error("[MONEY XMLRPC]: landBuy_func: request is null.");
|
||||
return new XmlRpcResponse { Value = new Hashtable { { "success", false } } };
|
||||
}
|
||||
|
||||
if (client == null)
|
||||
{
|
||||
m_log.Error("[MONEY XMLRPC]: landBuy_func: client is null.");
|
||||
return new XmlRpcResponse { Value = new Hashtable { { "success", false } } };
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_log.InfoFormat("[MONEY XMLRPC]: handleClient buyLandPrep.");
|
||||
XmlRpcResponse returnval = new XmlRpcResponse();
|
||||
Hashtable returnresp = new Hashtable();
|
||||
returnresp.Add("success", true);
|
||||
returnval.Value = returnresp;
|
||||
return returnval;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("[MONEY XMLRPC]: landBuy_func: {0}", ex.Message);
|
||||
return new XmlRpcResponse { Value = new Hashtable { { "success", false } } };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Preflights the buy land prep function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="client">The client.</param>
|
||||
/// <exception cref="System.NotImplementedException"></exception>
|
||||
private XmlRpcResponse preflightBuyLandPrep_func_old(XmlRpcRequest request, IPEndPoint client)
|
||||
{
|
||||
m_log.InfoFormat("[MONEY XMLRPC]: handleClient preflightBuyLandPrep.");
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>Preflights the buy land prep function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="client">The client.</param>
|
||||
private XmlRpcResponse preflightBuyLandPrep_func(XmlRpcRequest request, IPEndPoint client)
|
||||
{
|
||||
m_log.InfoFormat("[MONEY XMLRPC]: handleClient preflightBuyLandPrep.");
|
||||
|
||||
@@ -419,6 +475,38 @@ namespace OpenSim.Grid.MoneyServer
|
||||
returnval.Value = returnresp;
|
||||
return returnval;
|
||||
}
|
||||
/// <summary>Preflights the buy land prep function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="client">The client.</param>
|
||||
private XmlRpcResponse preflightBuyLandPrep_func(XmlRpcRequest request, IPEndPoint client)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
m_log.Error("[MONEY XMLRPC]: preflightBuyLandPrep_func: request is null.");
|
||||
return new XmlRpcResponse { Value = new Hashtable { { "success", false } } };
|
||||
}
|
||||
|
||||
if (client == null)
|
||||
{
|
||||
m_log.Error("[MONEY XMLRPC]: preflightBuyLandPrep_func: client is null.");
|
||||
return new XmlRpcResponse { Value = new Hashtable { { "success", false } } };
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_log.InfoFormat("[MONEY XMLRPC]: handleClient preflightBuyLandPrep.");
|
||||
XmlRpcResponse returnval = new XmlRpcResponse();
|
||||
Hashtable returnresp = new Hashtable();
|
||||
returnresp.Add("success", true);
|
||||
returnval.Value = returnresp;
|
||||
return returnval;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("[MONEY XMLRPC]: preflightBuyLandPrep_func: {0}", ex.Message);
|
||||
return new XmlRpcResponse { Value = new Hashtable { { "success", false } } };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the name of the SSL common.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
using log4net.Config;
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenSim.Grid.MoneyServer
|
||||
{
|
||||
class Program
|
||||
@@ -25,10 +27,25 @@ namespace OpenSim.Grid.MoneyServer
|
||||
/// <param name="args">The arguments.</param>
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
XmlConfigurator.Configure();
|
||||
MoneyServerBase app = new MoneyServerBase();
|
||||
app.Startup();
|
||||
app.Work();
|
||||
try
|
||||
{
|
||||
XmlConfigurator.Configure();
|
||||
MoneyServerBase app = new MoneyServerBase();
|
||||
if (app != null)
|
||||
{
|
||||
app.Startup();
|
||||
app.Work();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Failed to create MoneyServerBase instance.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("An error occurred: " + ex.Message);
|
||||
// You can also log the exception here, e.g., using a logging framework
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+76
-48
@@ -114,12 +114,11 @@ namespace OpenSim.Modules.Currency
|
||||
|
||||
private string m_moneyServURL = string.Empty;
|
||||
public BaseHttpServer HttpServer;
|
||||
|
||||
|
||||
private string m_certFilename = "";
|
||||
private string m_certPassword = "";
|
||||
private bool m_checkServerCert = false;
|
||||
private string m_cacertFilename = "";
|
||||
//private X509Certificate2 m_cert = null;
|
||||
|
||||
private bool m_use_web_settle = false;
|
||||
private string m_settle_url = "";
|
||||
@@ -129,16 +128,9 @@ namespace OpenSim.Modules.Currency
|
||||
private int m_hg_avatarClass = (int)AvatarType.HG_AVATAR;
|
||||
|
||||
private NSLCertificateVerify m_certVerify = new NSLCertificateVerify(); // For server authentication
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Scene dictionary indexed by Region Handle
|
||||
/// </summary>
|
||||
|
||||
private Dictionary<ulong, Scene> m_sceneList = new Dictionary<ulong, Scene>();
|
||||
|
||||
/// <summary>
|
||||
/// To cache the balance data while the money server is not available.
|
||||
/// </summary>
|
||||
|
||||
private Dictionary<UUID, int> m_moneyServer = new Dictionary<UUID, int>();
|
||||
|
||||
// Events
|
||||
@@ -180,7 +172,12 @@ namespace OpenSim.Modules.Currency
|
||||
Initialise(source);
|
||||
|
||||
// Check if the money server URL is null or empty
|
||||
if (string.IsNullOrEmpty(m_moneyServURL)) m_enable_server = false;
|
||||
//if (string.IsNullOrEmpty(m_moneyServURL)) m_enable_server = false;
|
||||
if (string.IsNullOrEmpty(m_moneyServURL))
|
||||
{
|
||||
m_log.ErrorFormat("[MONEY MODULE]: CurrencyServer URL not set.");
|
||||
m_enable_server = false;
|
||||
}
|
||||
|
||||
// Add the scene to the region
|
||||
AddRegion(scene);
|
||||
@@ -324,15 +321,21 @@ namespace OpenSim.Modules.Currency
|
||||
MainServer.Instance.HandleXmlRpcRequests((OSHttpRequest)request, (OSHttpResponse)response, m_rpcHandlers);
|
||||
m_log.InfoFormat("[MONEY MODULE]: Successfully processed request.");
|
||||
}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// m_log.ErrorFormat("[MONEY MODULE]: Error processing request: {0}", ex.Message);
|
||||
// response.StatusCode = 500; // Interner Serverfehler
|
||||
// response.RawBuffer = Encoding.UTF8.GetBytes("<response>Error</response>");
|
||||
//}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("[MONEY MODULE]: Error processing request: {0}", ex.Message);
|
||||
response.StatusCode = 500; // Interner Serverfehler
|
||||
m_log.ErrorFormat("[MONEY MODULE]: Error processing request. URL: {0}, Error: {1}", request.RawUrl, ex.ToString());
|
||||
response.StatusCode = 500;
|
||||
response.RawBuffer = Encoding.UTF8.GetBytes("<response>Error</response>");
|
||||
}
|
||||
}
|
||||
|
||||
private void LogXmlRpcRequest(IOSHttpRequest request)
|
||||
private void LogXmlRpcRequestFile(IOSHttpRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -357,6 +360,28 @@ namespace OpenSim.Modules.Currency
|
||||
m_log.ErrorFormat("[MONEY MODULE]: Error logging XML-RPC request: {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
private void LogXmlRpcRequest(IOSHttpRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Lies den Request-Body
|
||||
string requestBody;
|
||||
using (var reader = new StreamReader(request.InputStream, Encoding.UTF8))
|
||||
{
|
||||
requestBody = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
// Bereite den Logeintrag vor
|
||||
string logEntry = $"{DateTime.UtcNow}: {request.RawUrl}\n{requestBody}\n\n";
|
||||
|
||||
// Schreibe den Logeintrag in das Log
|
||||
m_log.Info(logEntry);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.ErrorFormat("[MONEY MODULE]: Error logging XML-RPC request: {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int CalculateCost(int currencyAmount)
|
||||
@@ -418,6 +443,24 @@ namespace OpenSim.Modules.Currency
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Buys the function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="remoteClient">The remote client.</param>
|
||||
public XmlRpcResponse buy_func(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
// Hashtable requestData = (Hashtable) request.Params[0];
|
||||
// UUID agentId = UUID.Zero;
|
||||
// int amount = 0;
|
||||
|
||||
XmlRpcResponse returnval = new XmlRpcResponse();
|
||||
Hashtable returnresp = new Hashtable();
|
||||
returnresp.Add("success", true);
|
||||
returnval.Value = returnresp;
|
||||
m_log.InfoFormat("[MONEY MODULE]: money buy", returnval.ToString());
|
||||
return returnval;
|
||||
}
|
||||
|
||||
/// <summary>Preflights the buy land prep function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="remoteClient">The remote client.</param>
|
||||
@@ -478,22 +521,6 @@ namespace OpenSim.Modules.Currency
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>Buys the function.</summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="remoteClient">The remote client.</param>
|
||||
public XmlRpcResponse buy_func(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
// Hashtable requestData = (Hashtable) request.Params[0];
|
||||
// UUID agentId = UUID.Zero;
|
||||
// int amount = 0;
|
||||
|
||||
XmlRpcResponse returnval = new XmlRpcResponse();
|
||||
Hashtable returnresp = new Hashtable();
|
||||
returnresp.Add("success", true);
|
||||
returnval.Value = returnresp;
|
||||
m_log.InfoFormat("[MONEY MODULE]: money buy", returnval.ToString());
|
||||
return returnval;
|
||||
}
|
||||
// Test End 2023
|
||||
|
||||
|
||||
@@ -522,17 +549,18 @@ namespace OpenSim.Modules.Currency
|
||||
HttpServer.AddXmlRPCHandler("OnMoneyTransfered", OnMoneyTransferedHandler);
|
||||
HttpServer.AddXmlRPCHandler("UpdateBalance", BalanceUpdateHandler);
|
||||
HttpServer.AddXmlRPCHandler("UserAlert", UserAlertHandler);
|
||||
HttpServer.AddXmlRPCHandler("GetBalance", GetBalanceHandler); // added
|
||||
HttpServer.AddXmlRPCHandler("AddBankerMoney", AddBankerMoneyHandler); // added
|
||||
HttpServer.AddXmlRPCHandler("SendMoney", SendMoneyHandler); // added
|
||||
HttpServer.AddXmlRPCHandler("MoveMoney", MoveMoneyHandler); // added
|
||||
HttpServer.AddXmlRPCHandler("GetBalance", GetBalanceHandler);
|
||||
HttpServer.AddXmlRPCHandler("AddBankerMoney", AddBankerMoneyHandler);
|
||||
HttpServer.AddXmlRPCHandler("SendMoney", SendMoneyHandler);
|
||||
HttpServer.AddXmlRPCHandler("MoveMoney", MoveMoneyHandler);
|
||||
|
||||
// OS Version > 0.9.2 ???
|
||||
m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); // add php 2023
|
||||
m_rpcHandlers.Add("getCurrencyQuote", quote_func); // add php 2023
|
||||
m_rpcHandlers.Add("buyCurrency", buy_func); // add php 2023
|
||||
m_rpcHandlers.Add("preflightBuyLandPrep", preflightBuyLandPrep_func); // add php 2023
|
||||
m_rpcHandlers.Add("buyLandPrep", landBuy_func); // add php 2023
|
||||
// Stellen Sie sicher, dass m_rpcHandlers korrekt initialisiert ist und dass MainServer.Instance nicht null ist.
|
||||
// Falls m_rpcHandlers nicht in Initialise() gesetzt wurde, fügen Sie eine Initialisierung hinzu:
|
||||
m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
|
||||
m_rpcHandlers.Add("getCurrencyQuote", quote_func);
|
||||
m_rpcHandlers.Add("buyCurrency", buy_func);
|
||||
m_rpcHandlers.Add("preflightBuyLandPrep", preflightBuyLandPrep_func);
|
||||
m_rpcHandlers.Add("buyLandPrep", landBuy_func);
|
||||
|
||||
MainServer.Instance.AddSimpleStreamHandler(new SimpleStreamHandler("/currency.php", processPHP));
|
||||
MainServer.Instance.AddSimpleStreamHandler(new SimpleStreamHandler("/landtool.php", processPHP));
|
||||
@@ -541,14 +569,14 @@ namespace OpenSim.Modules.Currency
|
||||
MainServer.Instance.AddXmlRPCHandler("OnMoneyTransfered", OnMoneyTransferedHandler);
|
||||
MainServer.Instance.AddXmlRPCHandler("UpdateBalance", BalanceUpdateHandler);
|
||||
MainServer.Instance.AddXmlRPCHandler("UserAlert", UserAlertHandler);
|
||||
MainServer.Instance.AddXmlRPCHandler("GetBalance", GetBalanceHandler); // added
|
||||
MainServer.Instance.AddXmlRPCHandler("AddBankerMoney", AddBankerMoneyHandler); // added
|
||||
MainServer.Instance.AddXmlRPCHandler("SendMoney", SendMoneyHandler); // added
|
||||
MainServer.Instance.AddXmlRPCHandler("MoveMoney", MoveMoneyHandler); // added
|
||||
MainServer.Instance.AddXmlRPCHandler("GetBalance", GetBalanceHandler);
|
||||
MainServer.Instance.AddXmlRPCHandler("AddBankerMoney", AddBankerMoneyHandler);
|
||||
MainServer.Instance.AddXmlRPCHandler("SendMoney", SendMoneyHandler);
|
||||
MainServer.Instance.AddXmlRPCHandler("MoveMoney", MoveMoneyHandler);
|
||||
|
||||
MainServer.Instance.AddXmlRPCHandler("getCurrencyQuote", quote_func); // add php 2023
|
||||
MainServer.Instance.AddXmlRPCHandler("preflightBuyLandPrep", preflightBuyLandPrep_func); // add php 2023
|
||||
MainServer.Instance.AddXmlRPCHandler("buyLandPrep", landBuy_func); // add php 2023
|
||||
MainServer.Instance.AddXmlRPCHandler("getCurrencyQuote", quote_func);
|
||||
MainServer.Instance.AddXmlRPCHandler("preflightBuyLandPrep", preflightBuyLandPrep_func);
|
||||
MainServer.Instance.AddXmlRPCHandler("buyLandPrep", landBuy_func);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
In this directory you can place addon modules for OpenSim
|
||||
|
||||
Each module should be in it's own tree and the root of the tree
|
||||
should contain a file named "prebuild.xml", which will be included in the
|
||||
main prebuild file.
|
||||
|
||||
The prebuild.xml should only contain <Project> and associated child tags.
|
||||
The <?xml>, <Prebuild>, <Solution> and <Configuration> tags should not be
|
||||
included since the add-on modules prebuild.xml will be inserted directly into the main prebuild.xml
|
||||
Reference in New Issue
Block a user