public void OnStartLure(byte lureType, string message, UUID targetid, IClientAPI client) { if (!(client.Scene is Scene)) { return; } Scene scene = (Scene)(client.Scene); ScenePresence presence = scene.GetScenePresence(client.AgentId); message += "@" + m_ThisGridURL; m_log.DebugFormat("[HG LURE MODULE]: TP invite with message {0}", message); UUID sessionID = UUID.Random(); GridInstantMessage m = new GridInstantMessage(scene, client.AgentId, client.FirstName + " " + client.LastName, targetid, (byte)InstantMessageDialog.RequestTeleport, false, message, sessionID, false, presence.AbsolutePosition, new Byte[0], true); m.RegionID = client.Scene.RegionInfo.RegionID.Guid; m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", m.imSessionID, m.RegionID, m.message); m_PendingLures.Add(sessionID, m, 7200); // 2 hours if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(m, delegate(bool success) { }); } }
public void OnStartLure(byte lureType, string message, UUID targetid, IClientAPI client) { if (!(client.Scene is Scene)) { return; } Scene scene = (Scene)(client.Scene); IScenePresence presence = scene.GetScenePresence(client.AgentId); UUID dest = Util.BuildFakeParcelID( scene.RegionInfo.RegionHandle, (uint)presence.AbsolutePosition.X, (uint)presence.AbsolutePosition.Y, (uint)presence.AbsolutePosition.Z); m_log.DebugFormat("TP invite with message {0}", message); GridInstantMessage m = new GridInstantMessage(scene, client.AgentId, client.FirstName + " " + client.LastName, targetid, (byte)InstantMessageDialog.RequestTeleport, false, message, dest, false, presence.AbsolutePosition, new Byte[0]); if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(m, delegate(bool success) { }); } }
void OnInstantMessage(IClientAPI client, GridInstantMessage im) { if (im.dialog == (byte)InstantMessageDialog.RequestLure) { if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(im, delegate(bool success) { }); } } }
public void OnStartLure(byte lureType, string message, UUID targetid, IClientAPI client) { if (!(client.Scene is Scene)) { return; } Scene scene = (Scene)(client.Scene); IScenePresence presence = scene.GetScenePresence(client.AgentId); UUID dest = Util.BuildFakeParcelID( scene.RegionInfo.RegionHandle, (uint)presence.AbsolutePosition.X, (uint)presence.AbsolutePosition.Y, (uint)presence.AbsolutePosition.Z); GridInstantMessage m; if (scene.Permissions.IsAdministrator(client.AgentId)) //if we are an admin { if (scene.Permissions.IsAdministrator(targetid)) //if they are an admin { //Gods do not tp other gods m = new GridInstantMessage(scene, client.AgentId, client.FirstName + " " + client.LastName, targetid, (byte)InstantMessageDialog.RequestTeleport, false, message, dest, false, presence.AbsolutePosition, new Byte[0]); } else { //God tp them m = new GridInstantMessage(scene, client.AgentId, client.FirstName + " " + client.LastName, targetid, (byte)InstantMessageDialog.GodLikeRequestTeleport, false, "", dest, false, presence.AbsolutePosition, new Byte[0]); } } else { //Not a god, so no god tp m = new GridInstantMessage(scene, client.AgentId, client.FirstName + " " + client.LastName, targetid, (byte)InstantMessageDialog.RequestTeleport, false, message, dest, false, presence.AbsolutePosition, new Byte[0]); } if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(m, delegate(bool success) { }); } }
public void OnStartLure(byte lureType, string message, UUID targetid, IClientAPI client) { IScenePresence presence = client.Scene.GetScenePresence(client.AgentId); UUID dest = Util.BuildFakeParcelID( client.Scene.RegionInfo.RegionHandle, (uint)presence.AbsolutePosition.X, (uint)presence.AbsolutePosition.Y, (uint)presence.AbsolutePosition.Z); string mainGridURL = GetMainGridURL(); message += "@" + mainGridURL;//Add it to the message GridInstantMessage m; if (m_allowGodTeleports && client.Scene.Permissions.IsGod(client.AgentId) && presence.GodLevel > 0) //if we are an admin and are in god mode { if (client.Scene.Permissions.IsGod(targetid)) //if they are an admin { //Gods do not tp other gods m = new GridInstantMessage(client.Scene, client.AgentId, client.FirstName + " " + client.LastName, targetid, (byte)InstantMessageDialog.RequestTeleport, false, message, dest, false, presence.AbsolutePosition, new Byte[0]); } else { //God tp them m = new GridInstantMessage(client.Scene, client.AgentId, client.FirstName + " " + client.LastName, targetid, (byte)InstantMessageDialog.GodLikeRequestTeleport, false, "", dest, false, presence.AbsolutePosition, new Byte[0]); } } else { //Not a god, so no god tp m = new GridInstantMessage(client.Scene, client.AgentId, client.FirstName + " " + client.LastName, targetid, (byte)InstantMessageDialog.RequestTeleport, false, message, dest, false, presence.AbsolutePosition, new Byte[0]); } m_PendingLures.Add(m.imSessionID, m, 7200); // 2 hours if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(m); } }
public void OnStartLure(byte lureType, string message, UUID targetid, IClientAPI client) { if (!(client.Scene is Scene)) { return; } Scene scene = (Scene)(client.Scene); ScenePresence presence = scene.GetScenePresence(client.AgentId); // Round up Z co-ordinate rather than round-down by casting. This stops tall avatars from being given // a teleport Z co-ordinate by short avatars that drops them through or embeds them in thin floors on // arrival. // // Ideally we would give the exact float position adjusting for the relative height of the two avatars // but it looks like a float component isn't possible with a parcel ID. UUID dest = Util.BuildFakeParcelID( scene.RegionInfo.RegionHandle, (uint)presence.AbsolutePosition.X, (uint)presence.AbsolutePosition.Y, (uint)presence.AbsolutePosition.Z + 2); m_log.DebugFormat("[LURE MODULE]: TP invite with message {0}, type {1}", message, lureType); GridInstantMessage m; if (scene.Permissions.IsAdministrator(client.AgentId) && presence.IsViewerUIGod && (!scene.Permissions.IsAdministrator(targetid))) { m = new GridInstantMessage(scene, client.AgentId, client.FirstName + " " + client.LastName, targetid, (byte)InstantMessageDialog.GodLikeRequestTeleport, false, message, dest, false, presence.AbsolutePosition, new Byte[0], true); } else { m = new GridInstantMessage(scene, client.AgentId, client.FirstName + " " + client.LastName, targetid, (byte)InstantMessageDialog.RequestTeleport, false, message, dest, false, presence.AbsolutePosition, new Byte[0], true); } if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(m, delegate(bool success) { }); } }
private OSDMap syncRecievedService_OnMessageReceived(OSDMap message) { string method = message["Method"]; if (method == "SendInstantMessages") { List <GridInstantMessage> messages = ((OSDArray)message["Messages"]).ConvertAll <GridInstantMessage>((o) => { GridInstantMessage im = new GridInstantMessage(); im.FromOSD((OSDMap)o); return(im); }); ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager>(); if (manager != null) { IMessageTransferModule messageTransfer = manager.Scene.RequestModuleInterface <IMessageTransferModule>(); if (messageTransfer != null) { foreach (GridInstantMessage im in messages) { messageTransfer.SendInstantMessage(im); } } } } return(null); }
/// <summary> /// Kicks or freezes User specified from the simulator. This logs them off of the grid /// </summary> /// <param name="godID">The person doing the kicking</param> /// <param name="agentID">the person that is being kicked</param> /// <param name="kickflags">Tells what to do to the user</param> /// <param name="reason">The message to send to the user after it's been turned into a field</param> public void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason) { // assuming automatic god rights on this for fast griefing reaction // this is also needed for kick via message if (!m_scene.Permissions.IsGod(godID)) { return; } int godlevel = 200; // update level so higher gods can kick lower ones ScenePresence god = m_scene.GetScenePresence(godID); if (god != null && god.GodController.GodLevel > godlevel) { godlevel = god.GodController.GodLevel; } if (agentID == ALL_AGENTS) { m_scene.ForEachRootScenePresence(delegate(ScenePresence p) { if (p.UUID != godID && godlevel > p.GodController.GodLevel) { doKickmodes(godID, p, kickflags, reason); } }); return; } ScenePresence sp = m_scene.GetScenePresence(agentID); if (sp == null || sp.IsChildAgent) { IMessageTransferModule transferModule = m_scene.RequestModuleInterface <IMessageTransferModule>(); if (transferModule != null) { m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID); transferModule.SendInstantMessage(new GridInstantMessage( m_scene, godID, "God", agentID, (byte)250, false, Utils.BytesToString(reason), UUID.Zero, true, new Vector3(), new byte[] { (byte)kickflags }, true), delegate(bool success) {}); } return; } if (godlevel <= sp.GodController.GodLevel) // no god wars { return; } if (sp.UUID == godID) { return; } doKickmodes(godID, sp, kickflags, reason); }
private void RelayInventoryOfferIM(Scene scene, ScenePresence user, GridInstantMessage im) { if (user != null) // Local (root agent or child agent) { // m_log.WarnFormat("[INVENTORY_OFFER]: Relaying IM {0} locally to {1}", im.dialog, im.toAgentID); user.ControllingClient.SendInstantMessage(im); } else { // m_log.WarnFormat("[INVENTORY_OFFER]: Relaying IM {0} remotely to {1}", im.dialog, im.toAgentID); if (m_TransferModule == null) { m_TransferModule = scene.RequestModuleInterface <IMessageTransferModule>(); } if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(im, delegate(bool success) { }); } else { m_log.ErrorFormat("[INVENTORY_OFFER]: Could not relay IM {0} remotely to {1}", im.dialog, im.toAgentID); } } }
void OnCompleteMovementToRegion(IClientAPI client, bool arg2) { if (m_log.IsDebugEnabled) { m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); } object sp = null; if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) { if (sp is ScenePresence && ((ScenePresence)sp).PresenceType != PresenceType.Npc) { AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId); if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 && m_OfflineIM != null && m_Messaging != null) { List <GridInstantMessage> ims = m_OfflineIM.GetMessages(aCircuit.AgentID); if (ims != null && ims.Count > 0) { foreach (GridInstantMessage im in ims) { m_Messaging.SendInstantMessage(im, delegate(bool success) { }); } } } } } }
private void SendMessageToGroup(GridInstantMessage im, UUID groupID) { if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); } foreach (GroupMembersData member in m_groupsModule.GroupMembersRequest(null, groupID)) { if (m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid)) { // Don't deliver messages to people who have dropped this session if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); } continue; } // Copy Message GridInstantMessage msg = new GridInstantMessage(); msg.imSessionID = im.imSessionID; msg.fromAgentName = im.fromAgentName; msg.message = im.message; msg.dialog = im.dialog; msg.offline = im.offline; msg.ParentEstateID = im.ParentEstateID; msg.Position = im.Position; msg.RegionID = im.RegionID; msg.binaryBucket = im.binaryBucket; msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); // Updat Pertinate fields to make it a "group message" msg.fromAgentID = groupID.Guid; msg.fromGroup = true; msg.toAgentID = member.AgentID.Guid; IClientAPI client = GetActiveClient(member.AgentID); if (client == null) { // If they're not local, forward across the grid if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID); } m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); } else { // Deliver locally, directly if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); } ProcessMessageFromGroupSession(msg); } } }
public void OnInstantMessage(IClientAPI client, GridInstantMessage im) { byte dialog = im.dialog; if (dialog != (byte)InstantMessageDialog.MessageFromAgent && dialog != (byte)InstantMessageDialog.StartTyping && dialog != (byte)InstantMessageDialog.StopTyping && dialog != (byte)InstantMessageDialog.MessageFromObject) { return; } if (m_TransferModule != null) { if (client == null) { UserAccount account = m_scenes[0].UserAccountService.GetUserAccount(m_scenes[0].RegionInfo.ScopeID, new UUID(im.fromAgentID)); if (account != null) { im.fromAgentName = account.Name; } else { im.fromAgentName = im.fromAgentName + "(No account found for this user)"; } } else { im.fromAgentName = client.Name; } m_TransferModule.SendInstantMessage(im, delegate(bool success) { if (dialog == (uint)InstantMessageDialog.StartTyping || dialog == (uint)InstantMessageDialog.StopTyping || dialog == (uint)InstantMessageDialog.MessageFromObject) { return; } if ((client != null) && !success) { client.SendInstantMessage( new GridInstantMessage( null, new UUID(im.fromAgentID), "System", new UUID(im.toAgentID), (byte)InstantMessageDialog.BusyAutoResponse, "Unable to send instant message. " + "User is not logged in.", false, new Vector3())); } } ); } }
public void SendInstantMessage(GridInstantMessage im) { IMessageTransferModule m_TransferModule = m_object.Scene.RequestModuleInterface <IMessageTransferModule>(); if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(im); } }
void OnIncomingInstantMessage(GridInstantMessage im) { if (im.dialog == (byte)InstantMessageDialog.RequestTeleport) { UUID sessionID = new UUID(im.imSessionID); if (!m_PendingLures.Contains(sessionID)) { m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", im.imSessionID, im.RegionID, im.message); m_PendingLures.Add(sessionID, im, 7200); // 2 hours } // Forward. We do this, because the IM module explicitly rejects // IMs of this type if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(im, delegate(bool success) { }); } } }
public void SendInstantMessage(GridInstantMessage im) { IMessageTransferModule msgTransferModule = m_scene.RequestModuleInterface <IMessageTransferModule>(); if (msgTransferModule != null) { msgTransferModule.SendInstantMessage(im, delegate(bool success) { if (!success) { m_log.Warn("SendInstantMessage unsuccessful"); } }); } }
private void SendIM(UUID agentId, Vector3 pos, UUID fromID, string fromName, string message) { if (_scenes.Count < 1) { return; // not ready to send the IM } Scene scene = _scenes[0]; if (m_TransferModule == null) // ready to send IM? { m_TransferModule = scene.RequestModuleInterface <IMessageTransferModule>(); if (m_TransferModule == null) { return; // not ready to send the IM } } GridInstantMessage msg = new GridInstantMessage(); msg.fromAgentID = fromID.Guid; msg.toAgentID = agentId.Guid; msg.imSessionID = fromID.Guid; // put all of these is the same IM "session" from the fromID msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); // timestamp; msg.fromAgentName = fromName; // Cap the message length at 1024. if (message != null && message.Length > 1024) { msg.message = message.Substring(0, 1024); } else { msg.message = message; } msg.dialog = (byte)InstantMessageDialog.MessageFromAgent; msg.fromGroup = false; // fromGroup; msg.offline = (byte)1; //yes, store for fetching missed IMs on login msg.ParentEstateID = 0; //ParentEstateID; msg.Position = pos; msg.RegionID = scene.RegionInfo.RegionID.Guid; //RegionID.Guid; // binaryBucket is the SL URL without the prefix, e.g. "Region/x/y/z" string url = EncodeURL(false, scene.RegionInfo.RegionName, msg.Position.X, msg.Position.Y, msg.Position.Z); byte[] bucket = Utils.StringToBytes(url); msg.binaryBucket = new byte[bucket.Length];// binaryBucket; bucket.CopyTo(msg.binaryBucket, 0); if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(msg, delegate(bool success) { }); } }
private void SendMutedUserIM(ChatSessionMember member, UUID GroupID) { GridInstantMessage img = new GridInstantMessage { toAgentID = member.AvatarKey, fromGroup = true, imSessionID = GroupID, dialog = 213, //Special mute one message = member.MuteText + "," + member.MuteVoice }; m_msgTransferModule.SendInstantMessage(img); }
public void OnStartLure(byte lureType, string message, UUID targetid, IClientAPI client) { IScenePresence presence = client.Scene.GetScenePresence(client.AgentId); Vector3 position = presence.AbsolutePosition + new Vector3(2, 0, 0) * presence.Rotation; UUID dest = Util.BuildFakeParcelID( client.Scene.RegionInfo.RegionHandle, (uint)position.X, (uint)position.Y, (uint)position.Z); GridInstantMessage m; if (m_allowGodTeleports && client.Scene.Permissions.CanGodTeleport(client.AgentId, targetid)) //if we are an admin and are in god mode { //God tp them m = new GridInstantMessage(client.Scene, client.AgentId, client.Name, targetid, (byte)InstantMessageDialog.GodLikeRequestTeleport, false, "", dest, false, presence.AbsolutePosition, new Byte[0]); } else { //Not a god, so no god tp m = new GridInstantMessage(client.Scene, client.AgentId, client.Name, targetid, (byte)InstantMessageDialog.RequestTeleport, false, message, dest, false, presence.AbsolutePosition, new Byte[0]); } if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(m); } }
public void OnStartLure(byte lureType, string message, UUID targetid, IClientAPI client) { IScenePresence presence = client.Scene.GetScenePresence(client.AgentId); Vector3 position = presence.AbsolutePosition + new Vector3(2, 0, 0) * presence.Rotation; UUID dest = Util.BuildFakeParcelID( client.Scene.RegionInfo.RegionHandle, (uint)position.X, (uint)position.Y, (uint)position.Z); GridInstantMessage m = new GridInstantMessage() { FromAgentID = client.AgentId, FromAgentName = client.Name, ToAgentID = targetid, Dialog = (byte)InstantMessageDialog.RequestTeleport, Message = message, SessionID = dest, Offline = 0, Position = presence.AbsolutePosition, BinaryBucket = new Byte[0], RegionID = client.Scene.RegionInfo.RegionID }; if (m_allowGodTeleports && client.Scene.Permissions.CanGodTeleport(client.AgentId, targetid)) //if we are an admin and are in god mode { //God tp them m.Dialog = (byte)InstantMessageDialog.GodLikeRequestTeleport; } if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(m); } }
public void GridKickUser(UUID agentID, string reason) { int godlevel = 240; // grid god default ScenePresence sp = m_scene.GetScenePresence(agentID); if (sp == null || sp.IsChildAgent) { IMessageTransferModule transferModule = m_scene.RequestModuleInterface <IMessageTransferModule>(); if (transferModule != null) { m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID); transferModule.SendInstantMessage(new GridInstantMessage( m_scene, Constants.servicesGodAgentID, "GRID", agentID, (byte)250, false, reason, UUID.Zero, true, new Vector3(), new byte[] { 0 }, true), delegate(bool success) { }); } return; } if (sp.IsDeleted) { return; } if (godlevel <= sp.GodController.GodLevel) // no god wars { if (m_dialogModule != null) { m_dialogModule.SendAlertToUser(sp.UUID, "GRID kick detected and ignored, kick reason: " + reason); } return; } if (sp.IsNPC) { INPCModule npcmodule = sp.Scene.RequestModuleInterface <INPCModule>(); if (npcmodule != null) { npcmodule.DeleteNPC(sp.UUID, sp.Scene); return; } } sp.ControllingClient.Kick(reason); sp.Scene.CloseAgent(sp.UUID, true); }
/// <summary> /// Send chat to all the members of this friend conference /// </summary> /// <param name="client"></param> /// <param name="im"></param> public void SendChatToSession(IClientAPI client, GridInstantMessage im) { ChatSession session; ChatSessions.TryGetValue(UUID.Parse(im.imSessionID.ToString()), out session); if (session == null) { return; } IEventQueueService eq = client.Scene.RequestModuleInterface <IEventQueueService>(); foreach (ChatSessionMember member in session.Members) { if (member.HasBeenAdded) { im.toAgentID = member.AvatarKey.Guid; im.binaryBucket = OpenMetaverse.Utils.StringToBytes(session.Name); im.RegionID = Guid.Empty; im.ParentEstateID = 0; //im.timestamp = 0; m_TransferModule.SendInstantMessage(im); } else { im.toAgentID = member.AvatarKey.Guid; eq.ChatterboxInvitation( session.SessionID , session.Name , new UUID(im.fromAgentID) , im.message , new UUID(im.toAgentID) , im.fromAgentName , im.dialog , im.timestamp , im.offline == 1 , (int)im.ParentEstateID , im.Position , 1 , new UUID(im.imSessionID) , false , OpenMetaverse.Utils.StringToBytes(session.Name) , findScene(member.AvatarKey).RegionInfo.RegionHandle ); } } }
public void SendMessageToGroup(GridInstantMessage im, UUID groupID) { if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); } // Copy Message GridInstantMessage msg = new GridInstantMessage(); msg.imSessionID = groupID.Guid; msg.fromAgentName = im.fromAgentName; msg.message = im.message; msg.dialog = im.dialog; msg.offline = im.offline; msg.ParentEstateID = im.ParentEstateID; msg.Position = im.Position; msg.RegionID = im.RegionID; msg.binaryBucket = im.binaryBucket; msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); msg.fromAgentID = im.fromAgentID; msg.fromGroup = true; foreach (GroupMembersData member in m_groupData.GetGroupMembers(UUID.Parse(msg.fromAgentID.ToString()), groupID)) { if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) { // Don't deliver messages to people who have dropped this session if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); } continue; } msg.toAgentID = member.AgentID.Guid; if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0}", member.AgentID); } m_msgTransferModule.SendInstantMessage(msg); } }
public bool GiveItem(UUID from, UUID to, UUID container, string itemname, Scene scene) { List <UUID> list = new List <UUID>(); m_TransferModule = scene.RequestModuleInterface <IMessageTransferModule>(); SceneObjectPart box = scene.GetSceneObjectPart(container); TaskInventoryItem inventoryItem = box.Inventory.GetInventoryItem(itemname); ScenePresence presence = scene.GetScenePresence(from); if (inventoryItem != null && inventoryItem.Type == 6) { list.Add(inventoryItem.ItemID); } UUID uUID = MoveInventory(scene, to, itemname, box, list); if (this.m_TransferModule != null) { byte[] copyIDBytes = uUID.GetBytes(); byte[] binaryBucket = new byte[1 + copyIDBytes.Length]; binaryBucket[0] = (byte)AssetType.Folder; Array.Copy(copyIDBytes, 0, binaryBucket, 1, copyIDBytes.Length); Vector3 absolutePosition = box.AbsolutePosition; GridInstantMessage im = new GridInstantMessage( scene, from, presence.Firstname + " " + presence.Lastname, to, (byte)InstantMessageDialog.InventoryOffered, false, inventoryItem.Name, uUID, false, absolutePosition, binaryBucket, true); m_TransferModule.SendInstantMessage(im, delegate(bool success) { }); } return(true); }
public void OnInstantMessage(IClientAPI client, GridInstantMessage im) { byte dialog = im.dialog; if (dialog != (byte)InstantMessageDialog.MessageFromAgent && dialog != (byte)InstantMessageDialog.BusyAutoResponse && dialog != (byte)InstantMessageDialog.RequestLure && dialog != (byte)InstantMessageDialog.StartTyping && dialog != (byte)InstantMessageDialog.StopTyping && dialog != (byte)InstantMessageDialog.MessageFromObject) { return; } if (m_TransferModule != null) { if (client != null && !String.IsNullOrEmpty(client.FirstName) && !String.IsNullOrEmpty(client.LastName)) { im.fromAgentName = client.Name; } m_TransferModule.SendInstantMessage(im, delegate(bool success) { if (dialog == (uint)InstantMessageDialog.StartTyping || dialog == (uint)InstantMessageDialog.StopTyping) { return; } if ((client != null) && !success) { client.SendInstantMessage( new GridInstantMessage( null, new UUID(im.fromAgentID), "System", new UUID(im.toAgentID), (byte)InstantMessageDialog.BusyAutoResponse, "Unable to send instant message. " + "User is not logged in.", false, new Vector3())); } } ); } }
protected void OfferInventory(string itemName) { SceneObjectPart sop = ButtonMap[m_playerId].Part; TaskInventoryItem item = sop.Inventory.GetInventoryItems(itemName)[0]; // destination is an avatar InventoryItemBase agentItem = sop.ParentGroup.Scene.MoveTaskInventoryItem(m_playerId, UUID.Zero, sop, item.ItemID); byte[] bucket = new byte[17]; bucket[0] = (byte)agentItem.InvType; byte[] objBytes = agentItem.ID.GetBytes(); Array.Copy(objBytes, 0, bucket, 1, 16); GridInstantMessage msg = new GridInstantMessage( sop.ParentGroup.Scene, sop.UUID, sop.Name, m_playerId, (byte)InstantMessageDialog.InventoryOffered, false, item.Name + "\n" + sop.Name + " is located at " + sop.ParentGroup.Scene.RegionInfo.RegionName + " " + sop.AbsolutePosition.ToString(), agentItem.ID, true, sop.AbsolutePosition, bucket, true); m_log.InfoFormat("[WATER WARS]: IMSessionId on sending inventory offer [{0}]", agentItem.ID); IMessageTransferModule module = sop.ParentGroup.Scene.RequestModuleInterface <IMessageTransferModule>(); if (module != null) { IClientAPI client = sop.ParentGroup.Scene.GetScenePresence(m_playerId).ControllingClient; client.OnInstantMessage += OnInstantMessage; module.SendInstantMessage(msg, delegate(bool success) {}); } }
private OSDMap syncRecievedService_OnMessageReceived(OSDMap message) { string method = message["Method"]; if (method == "SendInstantMessages") { List <GridInstantMessage> messages = ((OSDArray)message["Messages"]).ConvertAll <GridInstantMessage>((o) => { GridInstantMessage im = new GridInstantMessage(); im.FromOSD((OSDMap)o); return(im); }); ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager>(); if (manager != null) { foreach (GridInstantMessage im in messages) { Framework.PresenceInfo.IScenePresence UserPresence; foreach (IScene scene in manager.Scenes) { UserPresence = scene.GetScenePresence(im.ToAgentID); //AR: Do not fire for child agents or group messages are sent for every region if (UserPresence != null && UserPresence.IsChildAgent == false) { IMessageTransferModule messageTransfer = scene.RequestModuleInterface <IMessageTransferModule>(); if (messageTransfer != null) { messageTransfer.SendInstantMessage(im); } } } } } } return(null); }
private void OnOfferCallingCard(IClientAPI client, UUID destID, UUID transactionID) { ScenePresence sp = GetClientPresence(client.AgentId); if (sp != null) { // If we're in god mode, we reverse the meaning. Offer // calling card becomes "Take a calling card" for that // person, no matter if they agree or not. if (sp.GodLevel >= 200) { CreateCallingCard(client.AgentId, destID, UUID.Zero, true); return; } } IClientAPI dest = FindClientObject(destID); if (dest != null) { DoCallingCardOffer(dest, client.AgentId); return; } IMessageTransferModule transferModule = m_Scenes[0].RequestModuleInterface <IMessageTransferModule>(); if (transferModule != null) { transferModule.SendInstantMessage(new GridInstantMessage( client.Scene, client.AgentId, client.FirstName + " " + client.LastName, destID, (byte)211, false, String.Empty, transactionID, false, new Vector3(), new byte[0], true), delegate(bool success) { }); } }
public void OnInstantMessage(IClientAPI client, GridInstantMessage im) { byte dialog = im.dialog; if (dialog != (byte)InstantMessageDialog.MessageFromAgent && dialog != (byte)InstantMessageDialog.StartTyping && dialog != (byte)InstantMessageDialog.StopTyping && dialog != (byte)InstantMessageDialog.BusyAutoResponse && dialog != (byte)InstantMessageDialog.MessageFromObject) { return; } if (m_TransferModule != null) { if (client == null) { UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.AllScopeIDs, im.fromAgentID); if (account != null) { im.fromAgentName = account.Name; } else { im.fromAgentName = im.fromAgentName + "(No account found for this user)"; } } else { im.fromAgentName = client.Name; } m_TransferModule.SendInstantMessage(im); } }
private void OnCompleteMovementToRegion(IClientAPI client, bool arg2) { object sp = null; if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) { if (sp is ScenePresence && ((ScenePresence)sp).PresenceType != PresenceType.Npc) { AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId); if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 && m_OfflineIM != null && m_Messaging != null) { List <GridInstantMessage> ims = m_OfflineIM.GetMessages(aCircuit.AgentID); if (ims != null && ims.Count > 0) { foreach (GridInstantMessage im in ims) { m_Messaging.SendInstantMessage(im, delegate(bool success) { }); } } } } } }
private string dodelivery(UUID buyer, UUID box, string item) { List<UUID> list = new List<UUID> (); SceneObjectPart mbox = LocateBox (box); Scene current = LocateBoxScene (box); m_TransferModule = current.RequestModuleInterface<IMessageTransferModule> (); TaskInventoryItem inventoryItem = mbox.Inventory.GetInventoryItem (item); if (inventoryItem != null && inventoryItem.Type == 6) { list.Add (inventoryItem.ItemID); } UUID uUID = MoveInventory (current,buyer, item, mbox, list); m_Database.UpdateTranSession (transID, uUID); if (this.m_TransferModule != null) { byte[] copyIDBytes = uUID.GetBytes(); byte[] binaryBucket = new byte[1 + copyIDBytes.Length]; binaryBucket[0] = (byte)AssetType.Folder; Array.Copy(copyIDBytes, 0, binaryBucket, 1, copyIDBytes.Length); //byte[] bucket = new byte[] { (byte)AssetType.Folder }; Vector3 absolutePosition = mbox.AbsolutePosition; GridInstantMessage im = new GridInstantMessage( current, mbox.OwnerID, "Web Store", buyer, (byte)InstantMessageDialog.InventoryOffered, false, item, uUID, false, absolutePosition, binaryBucket, true); //GridInstantMessage im = new GridInstantMessage( // current, mbox.OwnerID, mbox.Name, // buyer, // (byte)InstantMessageDialog.InventoryOffered,false, // string.Format ("'{0}'", item),uUID, false, // absolutePosition,bucket,false); //GridInstantMessage im = new GridInstantMessage (current, mbox.OwnerID, mbox.Name, buyer, 9, false, string.Format ("'{0}'", item), uUID, false, absolutePosition, binaryBucket, false); m_TransferModule.SendInstantMessage (im, delegate(bool success) { }); m_Database.UpdateTranOffered (transID); } return "Item Delivered"; }
private void OnInstantMessage(IClientAPI client, GridInstantMessage im) { //MainConsole.Instance.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog); IScene clientScene = FindClientScene(client.AgentId); if (clientScene == null) // Something seriously wrong here. { MainConsole.Instance.DebugFormat("[INVENTORY TRANSFER]: Cannot find originating user scene"); return; } if (im.Dialog == (byte)InstantMessageDialog.InventoryOffered) { //MainConsole.Instance.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0])); if (im.BinaryBucket.Length < 17) // Invalid { MainConsole.Instance.DebugFormat("[INVENTORY TRANSFER]: Invalid length {0} for asset type {1}", im.BinaryBucket.Length, ((AssetType)im.BinaryBucket[0])); return; } UUID receipientID = im.ToAgentID; IScenePresence recipientUser = null; IScene recipientUserScene = FindClientScene(client.AgentId); if (recipientUserScene != null) { recipientUser = recipientUserScene.GetScenePresence(receipientID); } UUID copyID; // user is online now... if (recipientUser != null) { // First byte is the asset type AssetType assetType = (AssetType)im.BinaryBucket [0]; if (assetType == AssetType.Folder) { UUID folderID = new UUID(im.BinaryBucket, 1); MainConsole.Instance.DebugFormat( "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", folderID, im.ToAgentID); clientScene.InventoryService.GiveInventoryFolderAsync( receipientID, client.AgentId, folderID, UUID.Zero, (folder) => { if (folder == null) { client.SendAgentAlertMessage("Can't find folder to give. Nothing given.", false); return; } // The outgoing binary bucket should contain only the byte which signals an asset folder is // being copied and the following bytes for the copied folder's UUID copyID = folder.ID; byte[] copyIDBytes = copyID.GetBytes(); im.BinaryBucket = new byte[1 + copyIDBytes.Length]; im.BinaryBucket [0] = (byte)AssetType.Folder; Array.Copy(copyIDBytes, 0, im.BinaryBucket, 1, copyIDBytes.Length); // m_currencyService.UserCurrencyTransfer(im.FromAgentID, im.ToAgentID, 0, // "Inworld inventory folder transfer", TransactionType.GiveInventory, UUID.Zero); if (moneyService != null) { moneyService.Transfer(im.ToAgentID, im.FromAgentID, 0, "Inworld inventory folder transfer", TransactionType.GiveInventory); } if (recipientUser != null) { recipientUser.ControllingClient.SendBulkUpdateInventory(folder); im.SessionID = copyID; recipientUser.ControllingClient.SendInstantMessage(im); } }); } else { // First byte of the array is probably the item type // Next 16 bytes are the UUID UUID itemID = new UUID(im.BinaryBucket, 1); MainConsole.Instance.DebugFormat( "[INVENTORY TRANSFER]: (giving) Inserting item {0} into agent {1}'s inventory", itemID, im.ToAgentID); clientScene.InventoryService.GiveInventoryItemAsync( im.ToAgentID, im.FromAgentID, itemID, UUID.Zero, false, (itemCopy) => { if (itemCopy == null) { MainConsole.Instance.DebugFormat( "[INVENTORY TRANSFER]: (giving) Unable to find item {0} to give to agent {1}'s inventory", itemID, im.ToAgentID); client.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); return; } copyID = itemCopy.ID; Array.Copy(copyID.GetBytes(), 0, im.BinaryBucket, 1, 16); if (moneyService != null) { moneyService.Transfer(im.ToAgentID, im.FromAgentID, 0, "Inworld inventory item transfer", TransactionType.GiveInventory); } if (recipientUser != null) { recipientUser.ControllingClient.SendBulkUpdateInventory(itemCopy); im.SessionID = itemCopy.ID; recipientUser.ControllingClient.SendInstantMessage(im); } }); } } else { // recipient is offline. // Send the IM to the recipient. The item is already // in their inventory, so it will not be lost if // they are offline. // if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(im); } } } else if (im.Dialog == (byte)InstantMessageDialog.InventoryAccepted) { IScenePresence user = clientScene.GetScenePresence(im.ToAgentID); MainConsole.Instance.DebugFormat("[INVENTORY TRANSFER]: Acceptance message received"); if (user != null) // Local { user.ControllingClient.SendInstantMessage(im); } else { if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(im); } } } else if (im.Dialog == (byte)InstantMessageDialog.InventoryDeclined) { // Here, the recipient is local and we can assume that the // inventory is loaded. Courtesy of the above bulk update, // It will have been pushed to the client, too // IInventoryService invService = clientScene.InventoryService; MainConsole.Instance.DebugFormat("[INVENTORY TRANSFER]: Declined message received"); InventoryFolderBase trashFolder = invService.GetFolderForType(client.AgentId, InventoryType.Unknown, AssetType.TrashFolder); UUID inventoryID = im.SessionID; // The inventory item/folder, back from it's trip InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID); InventoryFolderBase folder = null; if (item != null && trashFolder != null) { item.Folder = trashFolder.ID; // Diva comment: can't we just update this item??? List <UUID> uuids = new List <UUID> { item.ID }; invService.DeleteItems(item.Owner, uuids); ILLClientInventory inventory = client.Scene.RequestModuleInterface <ILLClientInventory>(); if (inventory != null) { inventory.AddInventoryItemAsync(client, item); } } else { folder = new InventoryFolderBase(inventoryID, client.AgentId); folder = invService.GetFolder(folder); if (folder != null & trashFolder != null) { folder.ParentID = trashFolder.ID; invService.MoveFolder(folder); client.SendBulkUpdateInventory(folder); } } if ((null == item && null == folder) | null == trashFolder) { string reason = String.Empty; if (trashFolder == null) { reason += " Trash folder not found."; } if (item == null) { reason += " Item not found."; } if (folder == null) { reason += " Folder not found."; } client.SendAgentAlertMessage("Unable to delete " + "received inventory" + reason, false); } //m_currencyService.UserCurrencyTransfer(im.FromAgentID, im.ToAgentID, 0, // "Inworld inventory transfer declined", TransactionType.GiveInventory, UUID.Zero); if (moneyService != null) { moneyService.Transfer(im.ToAgentID, im.FromAgentID, 0, "Inworld inventory transfer declined", TransactionType.GiveInventory); } IScenePresence user = clientScene.GetScenePresence(im.ToAgentID); if (user != null) // Local { user.ControllingClient.SendInstantMessage(im); } else { if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(im); } } } }
private string dotransaction(UUID from, UUID to, int amount, int type, string message) { IClientAPI clientAPI = LocateClient (from); Scene scene = (Scene)clientAPI.Scene; m_MoneyModule = scene.RequestModuleInterface<IMoneyModule> (); m_TransferModule = scene.RequestModuleInterface<IMessageTransferModule> (); if (m_MoneyModule == null) { return "No Money Module Configured"; } bool flag = m_MoneyModule.AmountCovered (from, amount); if (flag) { scene.ProcessMoneyTransferRequest (from, to, amount, type, message); if (m_TransferModule != null) { GridInstantMessage im = new GridInstantMessage( scene, UUID.Zero, "Web Store", from, (byte)InstantMessageDialog.MessageFromAgent, "You made a Web Store purchase your item will be delivered shortly", false, new Vector3()); m_TransferModule.SendInstantMessage (im, delegate(bool success) { }); } m_Database.UpdateTranPaid (transID); return "transaction ok"; } return "Insuficient Funds"; }