About

Logs all the chat on a region in the current OpenSim directory under the directory Chatlogs. Each file will be numbered by the current date in the format dd/MM/yy.

Code

//MRM:C#
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
using OpenSim.Region.OptionalModules.Scripting.Minimodule;
using OpenMetaverse;
using System.IO;
 
namespace OpenSim  
{  
    class MiniModule : MRMBase  
    {  
        public override void Start()  
        {
            if(!Directory.Exists("Chatlogs")) {
                Directory.CreateDirectory("Chatlogs");
            }
            World.OnChat += World_OnChat;
        }
 
        void World_OnChat(IWorld sender, ChatEventArgs e)
        {
            if(e.Channel != 0) return;
            var dir = new DirectoryInfo(@"Chatlogs");
            using (StreamWriter w = File.AppendText(Path.Combine(@"Chatlogs", System.DateTime.Now.ToString("dd/MM/yy")) + ".txt")) {
                w.WriteLine(e.Sender.Name + ":" + e.Text);
            }
        }
 
        public override void Stop() {  
            World.OnChat -= World_OnChat;
        } 
    }
}

opensim/mini_region_modules/logging_chat/one_file.txt · Last modified: 2017/02/22 18:30 (external edit)

Access website using Tor


For the copyright, license, warranty and privacy terms for the usage of this website please see the license and privacy pages.