- a couple of minor code cleanups in RestInventoryServices
- cleanups and more comments in ChatModule and IRCBridgeModule - adding Name support in ScenePresence0.6.0-stable
parent
57a862bc01
commit
63b2e3575a
|
@ -1287,31 +1287,31 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
|||
Rest.Log.DebugFormat("{0} Item : {1} {2} {3} Type = {4}, AssetType = {5}",
|
||||
MsgId, i.ID, indent, i.Name, i.InvType, i.AssetType);
|
||||
|
||||
rdata.writer.WriteStartElement(String.Empty,"Item",String.Empty);
|
||||
rdata.writer.WriteStartElement(String.Empty, "Item", String.Empty);
|
||||
|
||||
rdata.writer.WriteAttributeString("name",String.Empty,i.Name);
|
||||
rdata.writer.WriteAttributeString("desc",String.Empty,i.Description);
|
||||
rdata.writer.WriteAttributeString("uuid",String.Empty,i.ID.ToString());
|
||||
rdata.writer.WriteAttributeString("folder",String.Empty,i.Folder.ToString());
|
||||
rdata.writer.WriteAttributeString("owner",String.Empty,i.Owner.ToString());
|
||||
rdata.writer.WriteAttributeString("creator",String.Empty,i.Creator.ToString());
|
||||
rdata.writer.WriteAttributeString("creationdate",String.Empty,i.CreationDate.ToString());
|
||||
rdata.writer.WriteAttributeString("type",String.Empty,i.InvType.ToString());
|
||||
rdata.writer.WriteAttributeString("assettype",String.Empty,i.AssetType.ToString());
|
||||
rdata.writer.WriteAttributeString("groupowned",String.Empty,i.GroupOwned.ToString());
|
||||
rdata.writer.WriteAttributeString("groupid",String.Empty,i.GroupID.ToString());
|
||||
rdata.writer.WriteAttributeString("saletype",String.Empty,i.SaleType.ToString());
|
||||
rdata.writer.WriteAttributeString("saleprice",String.Empty,i.SalePrice.ToString());
|
||||
rdata.writer.WriteAttributeString("flags",String.Empty,i.Flags.ToString("X"));
|
||||
rdata.writer.WriteAttributeString("name", String.Empty, i.Name);
|
||||
rdata.writer.WriteAttributeString("desc", String.Empty, i.Description);
|
||||
rdata.writer.WriteAttributeString("uuid", String.Empty, i.ID.ToString());
|
||||
rdata.writer.WriteAttributeString("folder", String.Empty, i.Folder.ToString());
|
||||
rdata.writer.WriteAttributeString("owner", String.Empty, i.Owner.ToString());
|
||||
rdata.writer.WriteAttributeString("creator", String.Empty, i.Creator.ToString());
|
||||
rdata.writer.WriteAttributeString("creationdate", String.Empty, i.CreationDate.ToString());
|
||||
rdata.writer.WriteAttributeString("type", String.Empty, i.InvType.ToString());
|
||||
rdata.writer.WriteAttributeString("assettype", String.Empty, i.AssetType.ToString());
|
||||
rdata.writer.WriteAttributeString("groupowned", String.Empty, i.GroupOwned.ToString());
|
||||
rdata.writer.WriteAttributeString("groupid", String.Empty, i.GroupID.ToString());
|
||||
rdata.writer.WriteAttributeString("saletype", String.Empty, i.SaleType.ToString());
|
||||
rdata.writer.WriteAttributeString("saleprice", String.Empty, i.SalePrice.ToString());
|
||||
rdata.writer.WriteAttributeString("flags", String.Empty, i.Flags.ToString());
|
||||
|
||||
rdata.writer.WriteStartElement(String.Empty,"Permissions",String.Empty);
|
||||
rdata.writer.WriteAttributeString("current",String.Empty,i.CurrentPermissions.ToString("X"));
|
||||
rdata.writer.WriteAttributeString("next",String.Empty,i.NextPermissions.ToString("X"));
|
||||
rdata.writer.WriteAttributeString("everyone",String.Empty,i.EveryOnePermissions.ToString("X"));
|
||||
rdata.writer.WriteAttributeString("base",String.Empty,i.BasePermissions.ToString("X"));
|
||||
rdata.writer.WriteStartElement(String.Empty, "Permissions", String.Empty);
|
||||
rdata.writer.WriteAttributeString("current", String.Empty, i.CurrentPermissions.ToString("X"));
|
||||
rdata.writer.WriteAttributeString("next", String.Empty, i.NextPermissions.ToString("X"));
|
||||
rdata.writer.WriteAttributeString("everyone", String.Empty, i.EveryOnePermissions.ToString("X"));
|
||||
rdata.writer.WriteAttributeString("base", String.Empty, i.BasePermissions.ToString("X"));
|
||||
rdata.writer.WriteEndElement();
|
||||
|
||||
rdata.writer.WriteElementString("Asset",i.AssetID.ToString());
|
||||
rdata.writer.WriteElementString("Asset", i.AssetID.ToString());
|
||||
|
||||
rdata.writer.WriteEndElement();
|
||||
}
|
||||
|
|
|
@ -63,9 +63,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
if (!m_scenes.Contains(scene))
|
||||
{
|
||||
m_scenes.Add(scene);
|
||||
scene.EventManager.OnNewClient += NewClient;
|
||||
scene.EventManager.OnChatFromWorld += SimChat;
|
||||
scene.EventManager.OnChatBroadcast += SimBroadcast;
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
scene.EventManager.OnChatFromWorld += OnSimChat;
|
||||
scene.EventManager.OnChatBroadcast += OnSimBroadcast;
|
||||
}
|
||||
|
||||
// wrap this in a try block so that defaults will work if
|
||||
|
@ -105,7 +105,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
#endregion
|
||||
|
||||
#region ISimChat Members
|
||||
public void SimBroadcast(Object sender, OSChatMessage c)
|
||||
public void OnSimBroadcast(Object sender, OSChatMessage c)
|
||||
{
|
||||
// We only want to relay stuff on channel 0 and on the debug channel
|
||||
if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return;
|
||||
|
@ -116,34 +116,44 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
if (c.Message.Length > 1100)
|
||||
c.Message = c.Message.Substring(0, 1000);
|
||||
|
||||
// chat works by redistributing every incoming chat
|
||||
// message to each avatar in the scene
|
||||
// broadcast chat works by redistributing every incoming chat
|
||||
// message to each avatar in the scene.
|
||||
Vector3 pos = new Vector3(128, 128, 30);
|
||||
((Scene)c.Scene).ForEachScenePresence(delegate(ScenePresence presence)
|
||||
((Scene)c.Scene).ForEachScenePresence(
|
||||
delegate(ScenePresence presence)
|
||||
{
|
||||
// ignore chat from child agents
|
||||
if (presence.IsChildAgent) return;
|
||||
|
||||
IClientAPI client = presence.ControllingClient;
|
||||
|
||||
// don't forward SayOwner chat from objects to
|
||||
// non-owner agents
|
||||
if ((c.Type == ChatTypeEnum.Owner) &&
|
||||
(null != c.SenderObject) &&
|
||||
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
|
||||
return;
|
||||
|
||||
if (null == c.SenderObject)
|
||||
{
|
||||
// chat from agent (avatar)
|
||||
client.SendChatMessage(c.Message, (byte)c.Type,
|
||||
pos, c.From, UUID.Zero,
|
||||
(byte)ChatSourceType.Agent,
|
||||
(byte)ChatAudibleLevel.Fully);
|
||||
}
|
||||
else
|
||||
{
|
||||
// chat from object
|
||||
client.SendChatMessage(c.Message, (byte)c.Type,
|
||||
pos, c.From, UUID.Zero,
|
||||
(byte)ChatSourceType.Object,
|
||||
(byte)ChatAudibleLevel.Fully);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void SimChat(Object sender, OSChatMessage e)
|
||||
public void OnSimChat(Object sender, OSChatMessage e)
|
||||
{
|
||||
// early return if not on public or debug channel
|
||||
if (e.Channel != 0 && e.Channel != DEBUG_CHANNEL) return;
|
||||
|
@ -188,7 +198,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
// message to each avatar in the scene
|
||||
foreach (Scene s in m_scenes)
|
||||
{
|
||||
s.ForEachScenePresence(delegate(ScenePresence presence)
|
||||
s.ForEachScenePresence(
|
||||
delegate(ScenePresence presence)
|
||||
{
|
||||
if (e.Channel == DEBUG_CHANNEL)
|
||||
{
|
||||
|
@ -208,11 +219,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
|
||||
#endregion
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
public void OnNewClient(IClientAPI client)
|
||||
{
|
||||
try
|
||||
{
|
||||
client.OnChatFromViewer += SimChat;
|
||||
client.OnChatFromViewer += OnSimChat;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -92,8 +92,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
if (!m_scenes.Contains(scene))
|
||||
{
|
||||
m_scenes.Add(scene);
|
||||
scene.EventManager.OnNewClient += NewClient;
|
||||
scene.EventManager.OnChatFromWorld += SimChat;
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
scene.EventManager.OnChatFromWorld += OnSimChat;
|
||||
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
|
||||
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
|
||||
#region ISimChat Members
|
||||
|
||||
public void SimChat(Object sender, OSChatMessage e)
|
||||
public void OnSimChat(Object sender, OSChatMessage e)
|
||||
{
|
||||
// We only want to relay stuff on channel 0
|
||||
if (e.Channel != 0) return;
|
||||
|
@ -233,15 +233,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
|
||||
#endregion
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
public void OnNewClient(IClientAPI client)
|
||||
{
|
||||
try
|
||||
{
|
||||
string clientName = String.Format("{0} {1}", client.FirstName, client.LastName);
|
||||
|
||||
client.OnChatFromViewer += SimChat;
|
||||
client.OnLogout += ClientLoggedOut;
|
||||
client.OnConnectionClosed += ClientLoggedOut;
|
||||
client.OnChatFromViewer += OnSimChat;
|
||||
client.OnLogout += OnClientLoggedOut;
|
||||
client.OnConnectionClosed += OnClientLoggedOut;
|
||||
|
||||
if (clientName != m_last_new_user)
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
}
|
||||
|
||||
|
||||
public void ClientLoggedOut(IClientAPI client)
|
||||
public void OnClientLoggedOut(IClientAPI client)
|
||||
{
|
||||
lock (m_syncLogout)
|
||||
{
|
||||
|
@ -614,10 +614,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
}
|
||||
}
|
||||
|
||||
static private Vector3 pos = new Vector3(128, 128, 20);
|
||||
public void ListenerRun()
|
||||
{
|
||||
string inputLine;
|
||||
Vector3 pos = new Vector3(128, 128, 20);
|
||||
|
||||
while (m_enabled)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -415,6 +415,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_controllingClient = client;
|
||||
m_firstname = m_controllingClient.FirstName;
|
||||
m_lastname = m_controllingClient.LastName;
|
||||
m_name = String.Format("{0} {1}", m_firstname, m_lastname);
|
||||
|
||||
m_scene = world;
|
||||
m_uuid = client.AgentId;
|
||||
|
|
Loading…
Reference in New Issue