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;
        } 
    }
}