//////////////////////////////////////////////// // Object-to-user inventory offers private void TaskInventoryOffer(IClientAPI client, Scene scene, GridInstantMessage im) { IMuteListModule m_muteListModule = scene.RequestModuleInterface <IMuteListModule>(); if (m_muteListModule != null) { UUID sender = new UUID(im.fromAgentID); UUID recipient = new UUID(im.toAgentID); if (m_muteListModule.IsMuted(sender, recipient)) { return; // recipient has sender muted } } RelayInventoryOfferIM(scene, im); }
public DateTime llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt) { if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) { return(DateTime.Now); } UUID avatarID = m_host.OwnerID; DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_host.UUID, m_itemID, 0); // only works on the first detected avatar //This only works in touch events or if the item is attached to the avatar if (detectedParams == null && !m_host.IsAttachment) { return(DateTime.Now); } if (detectedParams != null) { avatarID = detectedParams.Key; } IScenePresence avatar = World.GetScenePresence(avatarID); if (avatar != null) { IMuteListModule module = m_host.ParentEntity.Scene.RequestModuleInterface <IMuteListModule>(); if (module != null) { bool cached = false; //Unneeded if (module.GetMutes(avatar.UUID, out cached).Any(mute => mute.MuteID == m_host.OwnerID)) { return(DateTime.Now); //If the avatar is muted, they don't get any contact from the muted av } } avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname, new Vector3((float)pos.x, (float)pos.y, (float)pos.z), new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z)); } return(PScriptSleep(m_sleepMsOnMapDestination)); }
private bool IsMutedObject(SceneObjectGroup group, UUID senderID) { // This may seem backwards but if the payer has this object // or its owner muted, the object cannot give anything back // for payment. Do not allow payment to objects that are muted. if (m_muteListModule == null) m_muteListModule = group.Scene.RequestModuleInterface<IMuteListModule>(); if (m_muteListModule == null) return false; // payer has object owner muted? if (m_muteListModule.IsMuted(group.OwnerID, senderID)) return true; // payer has the object muted? if (m_muteListModule.IsMuted(group.UUID, senderID)) return true; // neither the object nor owner are muted return false; }
public void RegionLoaded(IScene scene) { m_muteListModule = m_scene.RequestModuleInterface <IMuteListModule>(); }
public void RegionLoaded (IScene scene) { m_muteListModule = m_scene.RequestModuleInterface<IMuteListModule> (); }
public void PostInitialize() { if (m_scenes.Count > 0) { m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>(); m_MuteListModule = m_initialScene.RequestModuleInterface<IMuteListModule>(); m_gridServices = m_initialScene.CommsManager.GridService; } if (m_TransferModule == null) m_log.Error("[FRIEND]: Unable to find a message transfer module, friendship offers will not work"); }
//////////////////////////////////////////////// // User-to-user inventory offers private void UserInventoryOffer(IClientAPI client, Scene scene, GridInstantMessage im) { InventoryFolderBase folder = null; InventoryItemBase item = null; UUID toAgentID = new UUID(im.toAgentID); IMuteListModule m_muteListModule = scene.RequestModuleInterface <IMuteListModule>(); if (m_muteListModule != null) { if (m_muteListModule.IsMuted(client.AgentId, toAgentID)) { client.SendAgentAlertMessage("Inventory offer was automatically declined.", false); return; // recipient has sender muted } } // Unpack the binary bucket AssetType assetType = (AssetType)im.binaryBucket[0]; UUID destID = new UUID(im.binaryBucket, 1); UUID copyID; bool isFolder = (assetType == AssetType.Folder); ScenePresence recipient = scene.GetScenePresence(toAgentID); if (recipient != null && recipient.IsBot) { client.SendAgentAlertMessage("Can't give inventory to bots.", false); return;//can't give objects to bots } if (assetType == AssetType.Folder) { folder = scene.GiveInventoryFolder(toAgentID, client.AgentId, destID, UUID.Zero); if (folder == null) { client.SendAgentAlertMessage("Can't find folder to give. Nothing given.", false); return; } copyID = folder.ID; } else { item = scene.GiveInventoryItem(toAgentID, client.AgentId, destID); if (item == null) { client.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); return; } copyID = item.ID; } // m_log.InfoFormat("[AGENT INVENTORY]: Offering {0} {1} to user {2} inventory as {3}", isFolder ? "folder" : "item", destID, toAgentID, copyID); // Update the asset type and destination ID into the outgoing IM. im.binaryBucket = new byte[17]; im.binaryBucket[0] = (byte)assetType; Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16); // Also stuff the destination ID into the session ID field for retrieval in accept/decline im.imSessionID = copyID.Guid; CachedUserInfo recipientInfo = scene.CommsManager.UserService.GetUserDetails(toAgentID); if (recipientInfo != null && recipient != null) { if ((!isFolder) && (item != null)) { // item offer? recipient.ControllingClient.SendInventoryItemCreateUpdate(item, 0); } if (isFolder && (folder != null)) { // folder offer? folder = recipientInfo.GetFolder(folder.ID); if (folder != null) { recipient.ControllingClient.SendBulkUpdateInventory(folder); recipientInfo.SendInventoryDecendents(recipient.ControllingClient, folder.ID, false, true); } } } // Send the IM to the recipient. The item is already in their inventory, so // it will not be lost if they are offline. Transaction ID is the item ID. // We get that same ID back on the reply so we know what to act on. RelayInventoryOfferIM(scene, recipient, im); }
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); // Group invitations if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) { UUID inviteID = new UUID(im.imSessionID); GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID); UUID fromAgentID = new UUID(im.fromAgentID); if ((inviteInfo != null) && (fromAgentID == inviteInfo.AgentID)) { // Accept if (im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received an accept invite notice."); // and the sessionid is the role m_groupData.AddAgentToGroup(GetClientGroupRequestID(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID, false); GridInstantMessage msg = new GridInstantMessage(); msg.imSessionID = UUID.Zero.Guid; msg.fromAgentID = UUID.Zero.Guid; msg.toAgentID = inviteInfo.AgentID.Guid; msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); msg.fromAgentName = "Groups"; msg.message = string.Format("You have been added to the group."); msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageBox; msg.fromGroup = false; msg.offline = (byte)0; // don't bother storing this one to fetch on login if user offline msg.ParentEstateID = 0; msg.Position = Vector3.Zero; msg.RegionID = UUID.Zero.Guid; msg.binaryBucket = new byte[0]; OutgoingInstantMessage(msg, inviteInfo.AgentID); UpdateAllClientsWithGroupInfo(inviteInfo.AgentID); // TODO: If the inviter is still online, they need an agent dataupdate // and maybe group membership updates for the invitee m_groupData.RemoveAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID); } // Reject if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received a reject invite notice."); m_groupData.RemoveAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID); } } } // Group notices if ((im.dialog == (byte)InstantMessageDialog.GroupNotice)) { if (!m_groupNoticesEnabled) { return; } if (im.offline != 0) { // Delivery of stored (offline) IMs is handled by the caller return; } UUID GroupID = new UUID(im.toAgentID); GroupRecord group = m_groupData.GetGroupRecord(GetClientGroupRequestID(remoteClient), GroupID, null); if (group == null) { m_log.ErrorFormat("[GROUPS]: Failed to find notice group {0}", GroupID); return; } UUID NoticeID = UUID.Random(); string Subject = im.message.Substring(0, im.message.IndexOf('|')); string Message = im.message.Substring(Subject.Length + 1); byte[] bucket; if ((im.binaryBucket.Length == 1) && (im.binaryBucket[0] == 0)) { // Sending a notice without an attachment bucket = new byte[19]; bucket[0] = 0; // HasAttachment boolean bucket[1] = 0; // attachment type GroupID.ToBytes(bucket, 2); bucket[18] = 0; // attachment name } else { // Sending a notice with an attachment string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket); binBucket = binBucket.Remove(0, 14).Trim(); OSDMap binBucketOSD = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket); UUID itemId = binBucketOSD["item_id"].AsUUID(); UUID ownerID = binBucketOSD["owner_id"].AsUUID(); if (ownerID != remoteClient.AgentId) { m_log.ErrorFormat("[GROUPS]: Notice attachment in group {0} not owned {1} by the user sending it {2}", GroupID.ToString(), ownerID.ToString(), remoteClient.AgentId); return; } CachedUserInfo ownerUserInfo = m_sceneList[0].CommsManager.UserService.GetUserDetails(ownerID); if (ownerUserInfo == null) { m_log.ErrorFormat("[GROUPS]: Failed to find notice sender {0} for item {1}", ownerID, itemId); return; } InventoryItemBase item = ownerUserInfo.FindItem(itemId); if (item == null) { m_log.ErrorFormat("[GROUPS]: Item {0} not found for notice sender {1}", itemId, ownerID); return; } if (!m_sceneList[0].Permissions.BypassPermissions()) { if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) || ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)) { remoteClient.SendAgentAlertMessage("Notice attachments must be copyable and transferable.", false); return; } } // Clone the item for storage as a group-owned item in the db that is NOT in any user's inventory. InventoryItemBase groupItem = AddToGroupInventory(remoteClient, group, item); // format for database storage bucket = FormatBucketForStorage(true, (byte)groupItem.AssetType, GroupID, groupItem.ID, NoticeID, item.Name); } if (m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket)) { // Once added to the DB above with owner ID, replace that with the GroupID that the viewers need GroupID.ToBytes(bucket, 2); // 16-byte UUID if (OnNewGroupNotice != null) { OnNewGroupNotice(GroupID, NoticeID); } // Get the list of users who have this sender muted. List<UUID> muters; m_muteListModule = m_sceneList[0].RequestModuleInterface<IMuteListModule>(); if (m_muteListModule != null) muters = m_muteListModule.GetInverseMuteList(remoteClient.AgentId); else muters = new List<UUID>(); // Send notice out to everyone that wants notices foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID, false)) { if (member.AcceptNotices && !muters.Contains(member.AgentID)) { SendGroupNoticeIM(NoticeID, member.AgentID, OpenMetaverse.InstantMessageDialog.GroupNotice, false); } } } } if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryDeclined) { if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: Declined - removing session {0}", im.imSessionID); lock (GroupAttachmentCache) { GroupAttachmentCache.Remove(im.imSessionID); } } if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryAccepted) { UUID NoticeID = UUID.Zero; lock (GroupAttachmentCache) { if (GroupAttachmentCache.ContainsKey(im.imSessionID)) { // Retrieve the notice ID and remove it from the cache. NoticeID = GroupAttachmentCache[im.imSessionID]; GroupAttachmentCache.Remove(im.imSessionID); } } if (NoticeID == UUID.Zero) { m_log.ErrorFormat("[GROUPS]: Accepted attachment for session {0} - NOT FOUND", im.imSessionID); remoteClient.SendAgentAlertMessage("Attachment not saved - specified group notice not found.", false); return; } if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: Accepted attachment for session {0} notice {1}", im.imSessionID, NoticeID); GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetClientGroupRequestID(remoteClient), NoticeID); if (notice == null) { remoteClient.SendAgentAlertMessage("Could not find the required group notice.", false); return; } InitializeNoticeFromBucket(notice); UUID groupId = notice.GroupID; UUID itemId = notice.noticeData.ItemID; // we need a userInfo structure to get the sessionID to use in case the inventory service needs a secure service connection CachedUserInfo userInfo = m_sceneList[0].CommsManager.UserService.GetUserDetails(remoteClient.AgentId); if (userInfo == null) { m_log.ErrorFormat("[GROUPS]: Failed to find notice recipient {0} for item {1}", remoteClient.AgentId, itemId); remoteClient.SendAgentAlertMessage("Attachment not saved - user profile not found.", false); return; } InventoryItemBase groupItem = FetchGroupItem(groupId, itemId); if (groupItem == null) // For now support fallback to the legacy inventory system. groupItem = FindLegacyInventoryItem(groupId, itemId); if (groupItem != null) { InventoryItemBase deliveredItem = DeliverGroupInventory(remoteClient, groupId, groupItem); if (deliveredItem != null) { remoteClient.SendInventoryItemCreateUpdate(deliveredItem, 0); remoteClient.SendAgentAlertMessage("Group notice attachment '"+groupItem.Name+"' saved to inventory.", false); } else { remoteClient.SendAgentAlertMessage("Attachment not saved - delivery failed.", false); m_log.ErrorFormat("[GROUPS]: Failed to deliver notice attachment {0} for {1}", itemId, remoteClient.AgentId); } } else { remoteClient.SendAgentAlertMessage("Attachment not saved - item not found.", false); m_log.ErrorFormat("[GROUPS]: Missing notice attachment {0} for {1}", itemId, remoteClient.AgentId); } if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: Accepted and completed for session {0}", im.imSessionID); } // Interop, received special 210 code for ejecting a group member // this only works within the comms servers domain, and won't work hypergrid // TODO:FIXME: Use a presense server of some kind to find out where the // client actually is, and try contacting that region directly to notify them, // or provide the notification via xmlrpc update queue if ((im.dialog == 210)) { // This is sent from the region that the ejectee was ejected from // if it's being delivered here, then the ejectee is here // so we need to send local updates to the agent. UUID ejecteeID = new UUID(im.toAgentID); im.dialog = (byte)InstantMessageDialog.MessageFromAgent; OutgoingInstantMessage(im, ejecteeID); IClientAPI ejectee = GetActiveClient(ejecteeID); if (ejectee != null) { UUID groupID = new UUID(im.fromAgentID); ejectee.SendAgentDropGroup(groupID); } } }
private void SendGroupNoticeIM(UUID NoticeID, UUID AgentID, OpenMetaverse.InstantMessageDialog dialog, bool checkMuted) { // Build notice IIM GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)dialog); if (msg == null) return; // old bad one stored from offlines? UUID sender = new UUID(msg.fromAgentID); if (checkMuted) { m_muteListModule = m_sceneList[0].RequestModuleInterface<IMuteListModule>(); if (m_muteListModule != null) if (m_muteListModule.IsMuted(sender, AgentID)) return; } bool HasAttachment = (msg.binaryBucket[0] != 0); if (HasAttachment) // save the notice with the session ID { lock (GroupAttachmentCache) { GroupAttachmentCache[msg.imSessionID] = NoticeID; } } msg.toAgentID = AgentID.Guid; IClientAPI localClient = GetActiveClient(AgentID); if (localClient != null) { if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: Recipient ({0}) is local, delivering group notice directly", localClient.Name); localClient.SendInstantMessage(msg); } else { // send for offline storage if (HasAttachment) // clean up the cache item added above { lock (GroupAttachmentCache) { GroupAttachmentCache.Remove(msg.imSessionID); } } // need to reformat this with db storage bucket, not the viewer IM bucket // format for database storage int bucketLen = msg.binaryBucket.Length; byte[] OfflineBucket = new byte[bucketLen + 4 + 16]; OfflineBucket[0] = 0xFF; // sign, would be 00 or 01 here in a normal viewer IM bucket OfflineBucket[1] = 0x00; OfflineBucket[2] = 0x00; OfflineBucket[3] = 0x00; // Spare bytes NoticeID.ToBytes(OfflineBucket, 4); // 16-byte UUID msg.binaryBucket.CopyTo(OfflineBucket, 20); msg.binaryBucket = OfflineBucket; if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: Recipient ({0}) is not local, delivering group notice via TransferModule", msg.toAgentID); m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Message Sent: {0}", success ? "Succeeded" : "Failed"); }); } }
// agentID and agentName are only used if remoteClient is null. // agentID/agentName is the requesting user, typically owner of the script requesting it. public int InviteGroupRequest(IClientAPI remoteClient, UUID agentID, string agentName, UUID groupID, UUID invitedAgentID, UUID roleID) { GroupRequestID grID = GetClientGroupRequestID(remoteClient); GroupRecord groupInfo = m_groupData.GetGroupRecord(grID, groupID, null); IScene scene = m_sceneList[0]; if (remoteClient != null) { agentID = remoteClient.AgentId; agentName = remoteClient.Name; scene = remoteClient.Scene; } string groupName; if (groupInfo != null) groupName = groupInfo.GroupName; else groupName = "(unknown)"; if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); // Get the list of users who have this sender muted. m_muteListModule = m_sceneList[0].RequestModuleInterface<IMuteListModule>(); if (m_muteListModule != null) { if (m_muteListModule.IsMuted(agentID, invitedAgentID)) { if (remoteClient != null) remoteClient.SendAlertMessage("You cannot invite someone who has you muted into a group."); return (int)Constants.GenericReturnCodes.MUTED; } } // Send notice out to everyone that wants notices // Todo: Security check, probably also want to send some kind of notification UUID InviteID = UUID.Random(); string reason = String.Empty; int rc = m_groupData.AddAgentToGroupInvite(grID, agentID, InviteID, groupID, roleID, invitedAgentID, out reason); if (rc != 0) { if ((remoteClient != null) && (reason != String.Empty)) remoteClient.SendAlertMessage(reason); return rc; } if (m_msgTransferModule == null) { if (remoteClient != null) remoteClient.SendAlertMessage("Error sending group invitation."); return (int)Constants.GenericReturnCodes.ERROR; } Guid inviteUUID = InviteID.Guid; GridInstantMessage msg = new GridInstantMessage(); msg.imSessionID = inviteUUID; // msg.fromAgentID = agentId.Guid; msg.fromAgentID = groupID.Guid; msg.toAgentID = invitedAgentID.Guid; //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); msg.timestamp = 0; msg.fromAgentName = agentName; msg.message = string.Format("{0} has invited you to join a group: {1}. There is no cost to join this group.", agentName, groupName); msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupInvitation; msg.fromGroup = true; msg.offline = (byte)1; //yes, store for fetching missed IMs on login msg.ParentEstateID = 0; msg.Position = Vector3.Zero; msg.RegionID = scene.RegionInfo.RegionID.Guid; msg.binaryBucket = new byte[20]; OutgoingInstantMessage(msg, invitedAgentID); if ((remoteClient != null) && (reason != String.Empty)) remoteClient.SendAlertMessage(reason); return (int)Constants.GenericReturnCodes.SUCCESS; }
private void SendMessageToGroup(IClientAPI remoteClient, GridInstantMessage im, UUID groupID) { if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); } List <UUID> muters; IMuteListModule m_muteListModule = m_sceneList[0].RequestModuleInterface <IMuteListModule>(); if (m_muteListModule != null) { muters = m_muteListModule.GetInverseMuteList(remoteClient.AgentId); } else { muters = new List <UUID>(); } List <GroupMembersData> members = m_groupsModule.GroupMembersRequest(null, null, UUID.Zero, groupID); foreach (GroupMembersData member in members) { if (HasAgentDroppedSession(member.AgentID.Guid, im.imSessionID)) { // 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; } if (member.OnlineStatus == false) { continue; } if ((member.AgentPowers & (ulong)GroupPowers.JoinChat) != (ulong)GroupPowers.JoinChat) { continue; } if (muters.Contains(member.AgentID)) { // Don't deliver messages to people who have the sender muted. continue; } // 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(); // Update pertinent fields to make it a "group message" msg.fromAgentID = im.fromAgentID; 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 virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) { UUID fromAgentID = new UUID(im.fromAgentID); UUID toAgentID = new UUID(im.toAgentID); foreach (Scene scene in m_Scenes) { if (!scene.EventManager.TriggerOnBeforeSendInstantMessage(im)) { m_log.WarnFormat("[INSTANT MESSAGE]: Outbound IM blocked by module"); return; } // Check for muted senders in specific IM cases. if (m_muteListModule == null) { m_muteListModule = scene.RequestModuleInterface <IMuteListModule>(); } if (m_muteListModule != null) { if ((im.dialog == (int)InstantMessageDialog.MessageFromAgent) || (im.dialog == (int)InstantMessageDialog.MessageFromObject)) { if (m_muteListModule.IsMuted(fromAgentID, toAgentID)) // owner ID is in fromAgentID in case of IMs from objects { return; // recipient has sender muted. } } } } //m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString()); // Try root avatar only first foreach (Scene scene in m_Scenes) { if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) { //m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName); // Local message ScenePresence user = (ScenePresence)scene.Entities[toAgentID]; if (!user.IsChildAgent) { //m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); user.ControllingClient.SendInstantMessage(im); // Message sent result(true); return; } } } // try child avatar second foreach (Scene scene in m_Scenes) { // m_log.DebugFormat( // "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) { // Local message ScenePresence user = (ScenePresence)scene.Entities[toAgentID]; //m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); user.ControllingClient.SendInstantMessage(im); // Message sent result(true); return; } } if (m_Gridmode) { //m_log.DebugFormat("[INSTANT MESSAGE]: Delivering via grid"); // Still here, try send via Grid SendGridInstantMessageViaXMLRPC(im, result); return; } HandleUndeliveredMessage(im, result); return; }
public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) { UUID fromAgentID = new UUID(im.fromAgentID); UUID toAgentID = new UUID(im.toAgentID); foreach (Scene scene in m_Scenes) { if (!scene.EventManager.TriggerOnBeforeSendInstantMessage(im)) { m_log.WarnFormat("[INSTANT MESSAGE]: Outbound IM blocked by module"); return; } // Check for muted senders in specific IM cases. if (m_muteListModule == null) m_muteListModule = scene.RequestModuleInterface<IMuteListModule>(); if (m_muteListModule != null) if ((im.dialog == (int)InstantMessageDialog.MessageFromAgent) || (im.dialog == (int)InstantMessageDialog.MessageFromObject)) if (m_muteListModule.IsMuted(fromAgentID, toAgentID)) // owner ID is in fromAgentID in case of IMs from objects return; // recipient has sender muted. } //m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString()); // Try root avatar only first foreach (Scene scene in m_Scenes) { if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) { //m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName); // Local message ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; if (!user.IsChildAgent) { //m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); user.ControllingClient.SendInstantMessage(im); // Message sent result(true); return; } } } // try child avatar second foreach (Scene scene in m_Scenes) { // m_log.DebugFormat( // "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) { // Local message ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; //m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); user.ControllingClient.SendInstantMessage(im); // Message sent result(true); return; } } if (m_Gridmode) { //m_log.DebugFormat("[INSTANT MESSAGE]: Delivering via grid"); // Still here, try send via Grid SendGridInstantMessageViaXMLRPC(im, result); return; } HandleUndeliveredMessage(im, result); return; }