当前位置: 首页>>代码示例>>C#>>正文


C# GridInstantMessage类代码示例

本文整理汇总了C#中GridInstantMessage的典型用法代码示例。如果您正苦于以下问题:C# GridInstantMessage类的具体用法?C# GridInstantMessage怎么用?C# GridInstantMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GridInstantMessage类属于命名空间,在下文中一共展示了GridInstantMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddOfflineMessage

 public void AddOfflineMessage(GridInstantMessage message)
 {
     foreach (string m_ServerURI in m_ServerURIs)
     {
         SimianUtils.AddGeneric(new UUID(message.toAgentID), "OfflineMessages", UUID.Random().ToString(), message.ToOSD(), m_ServerURI);
     }
 }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:7,代码来源:SimianOfflineMessagesConnector.cs

示例2: GetOfflineMessages

        public GridInstantMessage[] GetOfflineMessages(UUID PrincipalID)
        {
            OSDMap map = new OSDMap();

            map["PrincipalID"] = PrincipalID;
            map["Method"] = "getofflinemessages";

            List<GridInstantMessage> Messages = new List<GridInstantMessage>();
            try
            {
                List<string> urls =
                    m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(PrincipalID.ToString(),
                                                                                           "RemoteServerURI");
                foreach (string url in urls)
                {
                    OSDMap result = WebUtils.PostToService(url + "osd", map, true, false);
                    OSDArray array = (OSDArray) OSDParser.DeserializeJson(result["_RawResult"]);
                    foreach (OSD o in array)
                    {
                        GridInstantMessage message = new GridInstantMessage();
                        message.FromOSD((OSDMap) o);
                        Messages.Add(message);
                    }
                }
                return Messages.ToArray();
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteOfflineMessagesConnector]: Exception when contacting server: {0}", e);
            }
            return Messages.ToArray();
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:32,代码来源:RemoteOfflineMessagesConnector.cs

示例3: AddOfflineMessage

 public bool AddOfflineMessage (GridInstantMessage message)
 {
     List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService> ().FindValueOf (message.toAgentID.ToString (), "FriendsServerURI");
     if (serverURIs.Count > 0) //Remote user... or should be
         return m_remoteService.AddOfflineMessage (message);
     return m_localService.AddOfflineMessage (message);
 }
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:7,代码来源:IWCOfflineMessagesConnector.cs

示例4: syncRecievedService_OnMessageReceived

 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;
 }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:27,代码来源:InstantMessagingService.cs

示例5: AddOfflineMessage

 public bool AddOfflineMessage(GridInstantMessage message)
 {
     foreach (string m_ServerURI in m_ServerURIs)
     {
         SimianUtils.AddGeneric(message.toAgentID, "OfflineMessages", UUID.Random().ToString(), message.ToOSD(),
                                m_ServerURI);
     }
     return true;
 }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:9,代码来源:SimianOfflineMessagesConnector.cs

示例6: AddOfflineMessage

        public bool AddOfflineMessage(GridInstantMessage message)
        {
            object remoteValue = DoRemote(message);
            if (remoteValue != null || m_doRemoteOnly)
                return remoteValue == null ? false : (bool) remoteValue;

            if (m_maxOfflineMessages <= 0 ||
                GenericUtils.GetGenericCount(message.ToAgentID, "OfflineMessages", GD) < m_maxOfflineMessages)
            {
                GenericUtils.AddGeneric(message.ToAgentID, "OfflineMessages", UUID.Random().ToString(),
                                        message.ToOSD(), GD);
                return true;
            }
            return false;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:15,代码来源:LocalOfflineMessagesConnector.cs

示例7: GetOfflineMessages

 public GridInstantMessage[] GetOfflineMessages(UUID PrincipalID)
 {
     List<GridInstantMessage> Messages = new List<GridInstantMessage>();
     Dictionary<string, OSDMap> Maps = new Dictionary<string,OSDMap>();
     if(SimianUtils.GetGenericEntries(PrincipalID, "OfflineMessages", m_ServerURI, out Maps))
     {
         GridInstantMessage baseMessage = new GridInstantMessage();
         foreach(OSDMap map in Maps.Values)
         {
             baseMessage.FromOSD(map);
             Messages.Add(baseMessage);
         }
     }
     return Messages.ToArray();
 }
开发者ID:shangcheng,项目名称:Aurora,代码行数:15,代码来源:SimianOfflineMessagesConnector.cs

示例8: GetOfflineMessages

        public GridInstantMessage[] GetOfflineMessages(UUID PrincipalID)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["PRINCIPALID"] = PrincipalID;
            sendData["METHOD"] = "getofflinemessages";

            string reqString = WebUtils.BuildQueryString(sendData);
            List<GridInstantMessage> Messages = new List<GridInstantMessage>();
            try
            {
                List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(PrincipalID.ToString(), "RemoteServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                           m_ServerURI + "/auroradata",
                           reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        foreach (object f in replyData)
                        {
                            KeyValuePair<string, object> value = (KeyValuePair<string, object>)f;
                            if (value.Value is Dictionary<string, object>)
                            {
                                Dictionary<string, object> valuevalue = value.Value as Dictionary<string, object>;
                                GridInstantMessage message = new GridInstantMessage();
                                message.FromKVP(valuevalue);
                                Messages.Add(message);
                            }
                        }
                    }
                }
                return Messages.ToArray();
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteOfflineMessagesConnector]: Exception when contacting server: {0}", e.ToString());
            }
            return Messages.ToArray();
        }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:42,代码来源:RemoteOfflineMessagesConnector.cs

示例9: SendInstantMessages

        public virtual void SendInstantMessages(GridInstantMessage im, List<UUID> AgentsToSendTo)
        {
            //Check for local users first
            List<UUID> RemoveUsers = new List<UUID>();
            foreach (UUID t in AgentsToSendTo)
            {
                IScenePresence user;
                if (!RemoveUsers.Contains(t) &&
                    m_Scene.TryGetScenePresence(t, out user))
                {
                    // Local message
                    user.ControllingClient.SendInstantMessage(im);
                    RemoveUsers.Add(t);
                }
            }
            //Clear the local users out
            foreach (UUID agentID in RemoveUsers)
            {
                AgentsToSendTo.Remove(agentID);
            }

            SendMultipleGridInstantMessageViaXMLRPC(im, AgentsToSendTo);
        }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:23,代码来源:MessageTransferModule.cs

示例10: llGiveInventoryList

        public void llGiveInventoryList(string destination, string category, LSL_List inventory)
        {
            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
            

            UUID destID;
            if (!UUID.TryParse(destination, out destID))
                return;

            List<UUID> itemList = new List<UUID>();

            foreach (Object item in inventory.Data)
            {
                UUID itemID;
                if (UUID.TryParse(item.ToString(), out itemID))
                {
                    itemList.Add(itemID);
                }
                else
                {
                    itemID = GetTaskInventoryItem(item.ToString());
                    if (itemID != UUID.Zero)
                        itemList.Add(itemID);
                }
            }

            if (itemList.Count == 0)
                return;
            UUID folderID = UUID.Zero;
            ILLClientInventory inventoryModule = World.RequestModuleInterface<ILLClientInventory>();
            if (inventoryModule != null)
                folderID = inventoryModule.MoveTaskInventoryItemsToUserInventory(destID, category, m_host, itemList);

            if (folderID == UUID.Zero)
                return;

            byte[] bucket = new byte[17];
            bucket[0] = (byte)AssetType.Folder;
            byte[] objBytes = folderID.GetBytes();
            Array.Copy(objBytes, 0, bucket, 1, 16);

            GridInstantMessage msg = new GridInstantMessage(World,
                    m_host.UUID, m_host.Name+", an object owned by "+
                    resolveName(m_host.OwnerID)+",", destID,
                    (byte)InstantMessageDialog.InventoryOffered,
                    false, category+"\n"+m_host.Name+" is located at "+
                    World.RegionInfo.RegionName+" "+
                    m_host.AbsolutePosition.ToString(),
                    folderID, true, m_host.AbsolutePosition,
                    bucket);

            if (m_TransferModule != null)
                m_TransferModule.SendInstantMessage(msg);
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:54,代码来源:LSL_Api.cs

示例11: LocalFriendshipDenied

 public bool LocalFriendshipDenied(UUID userID, string userName, UUID friendID)
 {
     IClientAPI friendClient = LocateClientObject(friendID);
     if (friendClient != null)
     {
         // the prospective friend in this sim as root agent
         GridInstantMessage im = new GridInstantMessage(m_Scenes[0], userID, userName, friendID,
             (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero);
         friendClient.SendInstantMessage(im);
         // we're done
         return true;
     }
     
     return false;
 }
开发者ID:kchi059,项目名称:Aurora-Sim,代码行数:15,代码来源:FriendsModule.cs

示例12: llInstantMessage

        public DateTime llInstantMessage(string user, string message)
        {
            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
            

            // We may be able to use ClientView.SendInstantMessage here, but we need a client instance.
            // InstantMessageModule.OnInstantMessage searches through a list of scenes for a client matching the toAgent,
            // but I don't think we have a list of scenes available from here.
            // (We also don't want to duplicate the code in OnInstantMessage if we can avoid it.)

            UUID friendTransactionID = UUID.Random();

            GridInstantMessage msg = new GridInstantMessage();
            msg.fromAgentID = new Guid(m_host.UUID.ToString());
            msg.toAgentID = new Guid(user); 
            msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here
            msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
            msg.fromAgentName = m_host.Name;
            
            // 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.MessageFromObject;
            msg.fromGroup = false;
            msg.offline = (byte)0; 
            msg.ParentEstateID = 0;
            msg.Position = m_host.AbsolutePosition;
            msg.RegionID = World.RegionInfo.RegionID.Guid;
            msg.binaryBucket
                = Util.StringToBytes256(
                    "{0}/{1}/{2}/{3}",
                    World.RegionInfo.RegionName,
                    (int)Math.Floor(m_host.AbsolutePosition.X),
                    (int)Math.Floor(m_host.AbsolutePosition.Y),
                    (int)Math.Floor(m_host.AbsolutePosition.Z));

            if (m_TransferModule != null)
            {
                m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
            }
            return PScriptSleep(2000);
      }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:45,代码来源:LSL_Api.cs

示例13: llGiveInventory

        public DateTime llGiveInventory(string destination, string inventory)
        {
            ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
            
            bool found = false;
            UUID destId = UUID.Zero;
            UUID objId = UUID.Zero;
            int assetType = 0;
            string objName = String.Empty;

            if (!UUID.TryParse(destination, out destId))
            {
                llSay(0, "Could not parse key " + destination);
                return DateTime.Now;
            }

            // move the first object found with this inventory name
            lock (m_host.TaskInventory)
            {
                foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
                {
                    if (inv.Value.Name == inventory)
                    {
                        found = true;
                        objId = inv.Key;
                        assetType = inv.Value.Type;
                        objName = inv.Value.Name;
                        break;
                    }
                }
            }

            if (!found)
            {
                llSay(0, String.Format("Could not find object '{0}'", inventory));
                throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
            }

            GridUserInfo info = m_host.ParentGroup.Scene.GridUserService.GetGridUserInfo(destId.ToString());

            // check if destination is an avatar
            if ((info != null && info.Online) || World.GetScenePresence(destId) != null)
            {
                // destination is an avatar
                InventoryItemBase agentItem = null;
                ILLClientInventory inventoryModule = World.RequestModuleInterface<ILLClientInventory>();
                if(inventoryModule != null)
                    agentItem = inventoryModule.MoveTaskInventoryItemToUserInventory(destId, UUID.Zero, m_host, objId);

                if (agentItem == null)
                    return DateTime.Now;

                byte[] bucket = new byte[17];
                bucket[0] = (byte)assetType;
                byte[] objBytes = agentItem.ID.GetBytes();
                Array.Copy(objBytes, 0, bucket, 1, 16);

                OpenSim.Framework.Console.MainConsole.Instance.Output("Giving inventory to " + destId + " from " + m_host.Name, "None");
                GridInstantMessage msg = new GridInstantMessage(World,
                        m_host.UUID, m_host.Name+", an object owned by "+
                        resolveName(m_host.OwnerID)+",", destId,
                        (byte)InstantMessageDialog.InventoryOffered,
                        false, objName+"'\n'"+m_host.Name+"' is located at "+
                        m_host.AbsolutePosition.ToString() + " in '" + World.RegionInfo.RegionName,
                        agentItem.ID, true, m_host.AbsolutePosition,
                        bucket);

                if (m_TransferModule != null)
                    m_TransferModule.SendInstantMessage(msg);
            }
            else
            {
                // destination is an object
                ILLClientInventory inventoryModule = World.RequestModuleInterface<ILLClientInventory>();
                if (inventoryModule != null)
                    inventoryModule.MoveTaskInventoryItemToObject(destId, m_host, objId);
            }
            return PScriptSleep(3000);
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:79,代码来源:LSL_Api.cs

示例14: OnStartLure

        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 = "",
                    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);
        }
开发者ID:keverw,项目名称:Aurora-Sim,代码行数:34,代码来源:LureModule.cs

示例15: OnGridInstantMessage

        private void OnGridInstantMessage(GridInstantMessage im)
        {
            if (im.Dialog == (byte) InstantMessageDialog.RequestTeleport)
            {
                MainConsole.Instance.DebugFormat(
                    "[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", im.SessionID,
                    im.RegionID, im.Message);

                // Forward. We do this, because the IM module explicitly rejects
                // IMs of this type
                if (m_TransferModule != null)
                    m_TransferModule.SendInstantMessage(im);
            }
        }
开发者ID:keverw,项目名称:Aurora-Sim,代码行数:14,代码来源:LureModule.cs


注:本文中的GridInstantMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。