* Added a way for the Region master user to kick individual users from their sim with a custom message. Their client says, "You've been logged off of secondlife, <Your custom message here> and logs them off.

* Added a way for the Region master user to kick *ALL* users from *ALL* their regions in the estate with a custom message.
afrisby
Teravus Ovares 2007-11-24 03:28:42 +00:00
parent 2f4f83e343
commit 944b118c62
7 changed files with 101 additions and 21 deletions

View File

@ -269,6 +269,8 @@ namespace OpenSim.Framework
public delegate void RequestGodlikePowers(LLUUID AgentID, LLUUID SessionID, LLUUID token, IClientAPI remote_client);
public delegate void GodKickUser(LLUUID GodAgentID, LLUUID GodSessionID, LLUUID AgentID, uint kickflags, byte[] reason);
public delegate void CreateInventoryFolder(
IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID);
@ -333,6 +335,7 @@ namespace OpenSim.Framework
event AddNewPrim OnAddPrim;
event RequestGodlikePowers OnRequestGodlikePowers;
event GodKickUser OnGodKickUser;
event ObjectDuplicate OnObjectDuplicate;
event UpdateVector OnGrabObject;
@ -472,6 +475,7 @@ namespace OpenSim.Framework
void SetDebug(int newDebug);
void InPacket(Packet NewPack);
void Close();
void Kick(string message);
void Stop();
event ViewerEffectEventHandler OnViewerEffect;
event Action<IClientAPI> OnLogout;

View File

@ -66,6 +66,7 @@ namespace OpenSim.Region.ClientStack
public event MoveObject OnGrabUpdate;
public event AddNewPrim OnAddPrim;
public event RequestGodlikePowers OnRequestGodlikePowers;
public event GodKickUser OnGodKickUser;
public event ObjectExtraParams OnUpdateExtraParams;
public event UpdateShape OnUpdatePrimShape;
public event ObjectSelect OnObjectSelect;

View File

@ -1075,11 +1075,18 @@ namespace OpenSim.Region.ClientStack
break;
case PacketType.GodKickUser:
//GodKickUserPacket gkupack = (GodKickUserPacket) Pack;
//gkupack.UserInfo.GodID;
//gkupack.UserInfo.AgentID;
//gkupack.UserInfo.KickFlags;
//gkupack.UserInfo.Reason;
OpenSim.Framework.Console.MainLog.Instance.Verbose("CLIENT", "unhandled packet " + Pack.ToString());
GodKickUserPacket gkupack = (GodKickUserPacket) Pack;
if (gkupack.UserInfo.GodSessionID == SessionId && this.AgentId == gkupack.UserInfo.GodID)
{
OnGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, gkupack.UserInfo.AgentID, (uint) 0, gkupack.UserInfo.Reason);
}
else
{
SendAgentAlertMessage("Kick request denied", false);
}
//KickUserPacket kupack = new KickUserPacket();
//KickUserPacket.UserInfoBlock kupackib = kupack.UserInfo;

View File

@ -308,7 +308,20 @@ namespace OpenSim.Region.ClientStack
ClientThread.Abort();
}
public void Kick(string message)
{
KickUserPacket kupack = new KickUserPacket();
kupack.UserInfo.AgentID = AgentId;
kupack.UserInfo.SessionID = SessionId;
kupack.TargetBlock.TargetIP = (uint)0;
kupack.TargetBlock.TargetPort = (ushort)0;
kupack.UserInfo.Reason = Helpers.StringToField(message);
OutPacket(kupack, ThrottleOutPacketType.Task);
}
public void Stop()
{
clientPingTimer.Stop();

View File

@ -257,9 +257,15 @@ namespace OpenSim.Region.Environment.Scenes
{
ForEachScenePresence(delegate(ScenePresence avatar)
{
avatar.Kick("The region is going down.");
avatar.ControllingClient.Stop();
avatar.ControllingClient.Kick("The region is going down.");
});
ForEachScenePresence(delegate(ScenePresence avatar)
{
avatar.ControllingClient.Stop();
});
m_heartbeatTimer.Close();
m_innerScene.Close();
@ -831,6 +837,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
client.OnRequestGodlikePowers += handleRequestGodlikePowers;
client.OnGodKickUser += handleGodlikeKickUser;
client.OnCreateNewInventoryItem += CreateNewInventoryItem;
client.OnCreateNewInventoryFolder += CommsManager.UserProfileCache.HandleCreateInventoryFolder;
@ -884,7 +891,18 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresence avatar = GetScenePresence(agentID);
Broadcast(delegate(IClientAPI client) { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); });
Broadcast(delegate(IClientAPI client) {
try
{
client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
}
catch (NullReferenceException NE)
{
//We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway.
}
});
ForEachScenePresence(
delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
@ -1209,6 +1227,51 @@ namespace OpenSim.Region.Environment.Scenes
}
public void handleGodlikeKickUser(LLUUID godid, LLUUID sessionid, LLUUID agentid, uint kickflags, byte[] reason)
{
// For some reason the client sends the seemingly hard coded, 44e87126e7944ded05b37c42da3d5cdb
// for kicking everyone. Dun-know.
if (m_scenePresences.ContainsKey(agentid) || agentid == new LLUUID("44e87126e7944ded05b37c42da3d5cdb"))
{
if (godid == RegionInfo.MasterAvatarAssignedUUID)
{
if (agentid == new LLUUID("44e87126e7944ded05b37c42da3d5cdb"))
{
ClientManager.ForEachClient(delegate (IClientAPI controller)
{
if (controller.AgentId != godid) // Do we really want to kick the initiator of this madness?
{
controller.Kick(Helpers.FieldToUTF8String(reason));
}
}
);
// This is a bit crude. It seems the client will be null before it actually stops the thread
// The thread will kill itself eventually :/
// Is there another way to make sure *all* clients get this 'inter region' message?
ClientManager.ForEachClient(delegate (IClientAPI controller)
{
if (controller.AgentId != godid) // Do we really want to kick the initiator of this madness?
{
controller.Close();
}
}
);
}
else
{
m_scenePresences[agentid].ControllingClient.Kick(Helpers.FieldToUTF8String(reason));
m_scenePresences[agentid].ControllingClient.Close();
}
}
else
{
if (m_scenePresences.ContainsKey(godid))
m_scenePresences[godid].ControllingClient.SendAgentAlertMessage("Kick request denied", false);
}
}
}
public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
{
foreach (ScenePresence presence in m_scenePresences.Values)

View File

@ -1219,20 +1219,7 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
public void Kick(string message)
{
KickUserPacket kupack = new KickUserPacket();
KickUserPacket.UserInfoBlock kupackib = kupack.UserInfo;
kupack.UserInfo.AgentID = UUID;
kupack.UserInfo.SessionID = this.ControllingClient.SessionId;
kupack.TargetBlock.TargetIP = (uint)0;
kupack.TargetBlock.TargetPort = (ushort)0;
kupack.UserInfo.Reason = Helpers.StringToField(message);
ControllingClient.OutPacket(kupack, ThrottleOutPacketType.Task);
}
public void GrantGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token)
{
GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket();

View File

@ -76,6 +76,7 @@ namespace SimpleApp
public event Action<IClientAPI> OnRequestAvatarsData;
public event AddNewPrim OnAddPrim;
public event RequestGodlikePowers OnRequestGodlikePowers;
public event GodKickUser OnGodKickUser;
public event ObjectDuplicate OnObjectDuplicate;
public event UpdateVector OnGrabObject;
public event ObjectSelect OnDeGrabObject;
@ -181,6 +182,10 @@ namespace SimpleApp
{
}
public virtual void Kick(string message)
{
}
public virtual void SendStartPingCheck(byte seq)
{
}