About

Logs chat to the current OpenSim directory under Chatlogs and saves the logs named after the agents.

Code

chat_logger.cs
//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", e.Sender.Name) + ".txt")) {
                w.WriteLine(e.Text);
            }
        }
 
        public override void Stop() {  
            World.OnChat -= World_OnChat;
        } 
    }
}