aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs
blob: 5d33b04f78457073b5b501383dcf3543a26e68e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
using System.Reflection;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using log4net;
using Nini.Config;

namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
{
    public class EmailModule : IEmailModule
    {
        //
        // Log
        //
        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        //
        // Module vars
        //
        private IConfigSource m_Config;

        // Scenes by Region Handle
        private Dictionary<ulong, Scene> m_Scenes =
                new Dictionary<ulong, Scene>();

		private bool m_Enabled = false;

        public void Initialise(Scene scene, IConfigSource config)
        {
            m_Config = config;

            IConfig startupConfig = m_Config.Configs["Startup"];

			m_Enabled = (startupConfig.GetString("emailmodule",
					"DefaultEmailModule") == "DefaultEmailModule");

            // It's a go!
            if (m_Enabled)
            {
                lock (m_Scenes)
                {
                    // Claim the interface slot
                    scene.RegisterModuleInterface<IEmailModule>(this);

                    // Add to scene list
                    if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle))
                    {
                        m_Scenes[scene.RegionInfo.RegionHandle] = scene;
                    }
                    else
                    {
                        m_Scenes.Add(scene.RegionInfo.RegionHandle, scene);
                    }
                }

                m_log.Info("[EMAIL] Activated DefaultEmailModule");
            }
        }

        public void PostInitialise()
        {
        }

        public void Close()
        {
        }

        public string Name
        {
            get { return "DefaultEmailModule"; }
        }

        public bool IsSharedModule
        {
            get { return true; }
        }

        public void SendEmail(LLUUID objectID, string address, string subject, string body)
		{
		}

		public Email GetNextEmail(LLUUID objectID, string sender, string subject)
		{
			return null;
		}
	}
}