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


C# Framework.GridInstantMessage类代码示例

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


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

示例1: SendInstantMessages

        public virtual void SendInstantMessages(GridInstantMessage im, List<UUID> AgentsToSendTo)
        {
            //Check for local users first
            List<UUID> RemoveUsers = new List<UUID>();
            foreach (IScene scene in m_Scenes)
            {
                foreach (UUID t in AgentsToSendTo)
                {
                    IScenePresence user;
                    if (!RemoveUsers.Contains(t) &&
                        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:JAllard,项目名称:Aurora-Sim,代码行数:26,代码来源:MessageTransferModule.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:satlanski2,项目名称:Aurora-Sim,代码行数:32,代码来源:RemoteOfflineMessagesConnector.cs

示例3: SendMessageToGroup

        public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
        {
            if (m_debugEnabled)
                MainConsole.Instance.DebugFormat("[GROUPS-MESSAGING]: {0} called", MethodBase.GetCurrentMethod().Name);

            // Copy Message

            GridInstantMessage msg = new GridInstantMessage
                                         {
                                             imSessionID = groupID,
                                             fromAgentName = im.fromAgentName,
                                             message = im.message,
                                             dialog = (byte) InstantMessageDialog.SessionSend,
                                             offline = 0,
                                             ParentEstateID = 0,
                                             Position = Vector3.Zero,
                                             RegionID = UUID.Zero
                                         };
            ChatSession session = m_groupData.GetSession(im.imSessionID);
            msg.binaryBucket = Utils.StringToBytes(session.Name);
            msg.timestamp = (uint) Util.UnixTimeSinceEpoch();

            msg.fromAgentID = im.fromAgentID;
            msg.fromGroup = true;

            Util.FireAndForget(SendInstantMessages, msg);
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:27,代码来源:GroupsMessagingModule.cs

示例4: 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 (bool)DoRemote(message);
     return m_localService.AddOfflineMessage(message);
 }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:9,代码来源:IWCOfflineMessagesConnector.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:satlanski2,项目名称:Aurora-Sim,代码行数:9,代码来源:SimianOfflineMessagesConnector.cs

示例6: GetOfflineMessages

 public GridInstantMessage[] GetOfflineMessages(UUID PrincipalID)
 {
     List<GridInstantMessage> Messages = new List<GridInstantMessage>();
     Dictionary<string, OSDMap> Maps = new Dictionary<string, OSDMap>();
     foreach (string m_ServerURI in m_ServerURIs)
     {
         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:satlanski2,项目名称:Aurora-Sim,代码行数:18,代码来源:SimianOfflineMessagesConnector.cs

示例7: BuildGroupNoticeIM

        private GridInstantMessage BuildGroupNoticeIM(GroupNoticeInfo data, UUID groupNoticeID, UUID AgentID)
        {
            GridInstantMessage msg = new GridInstantMessage
                                         {
                                             fromAgentID = data.GroupID,
                                             toAgentID = AgentID,
                                             timestamp = data.noticeData.Timestamp,
                                             fromAgentName = data.noticeData.FromName,
                                             message = data.noticeData.Subject + "|" + data.Message,
                                             dialog = (byte) InstantMessageDialog.GroupNoticeRequested,
                                             fromGroup = true,
                                             offline = 1,
                                             ParentEstateID = 0,
                                             Position = Vector3.Zero,
                                             RegionID = UUID.Zero,
                                             imSessionID = UUID.Random()
                                         };

            //Allow offline

            if (data.noticeData.HasAttachment)
            {
                msg.binaryBucket = CreateBitBucketForGroupAttachment(data.noticeData, data.GroupID);
                //Save the sessionID for the callback by the client (reject or accept)
                //Only save if has attachment
                msg.imSessionID = data.noticeData.ItemID;
                //GroupAttachmentCache[msg.imSessionID] = data.noticeData.ItemID;
            }
            else
            {
                byte[] bucket = new byte[19];
                bucket[0] = 0; //Attachment enabled == false so 0
                bucket[1] = 0; //No attachment, so no asset type
                data.GroupID.ToBytes(bucket, 2);
                bucket[18] = 0; //dunno
                msg.binaryBucket = bucket;
            }
            return msg;
        }
开发者ID:BillyWarrhol,项目名称:Aurora-Sim,代码行数:39,代码来源:GroupsModule.cs

示例8: OnGridInstantMessage

        private void OnGridInstantMessage(GridInstantMessage msg)
        {
            // The instant message module will only deliver messages of dialog types:
            // MessageFromAgent, StartTyping, StopTyping, MessageFromObject
            //
            // Any other message type will not be delivered to a client by the 
            // Instant Message Module


            if (m_debugEnabled)
            {
                MainConsole.Instance.DebugFormat("[GROUPS-MESSAGING]: {0} called", MethodBase.GetCurrentMethod().Name);

                DebugGridInstantMessage(msg);
            }

            // Incoming message from a group
            if (msg.fromGroup &&
                ((msg.dialog == (byte) InstantMessageDialog.SessionSend)
                 || (msg.dialog == (byte) InstantMessageDialog.SessionAdd)
                 || (msg.dialog == (byte) InstantMessageDialog.SessionDrop)
                 || (msg.dialog == 212)
                 || (msg.dialog == 213)))
            {
                ProcessMessageFromGroupSession(msg);
            }
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:27,代码来源:GroupsMessagingModule.cs

示例9: ProcessMessageFromGroupSession

        private void ProcessMessageFromGroupSession(GridInstantMessage msg)
        {
            if (m_debugEnabled)
                MainConsole.Instance.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName,
                                  msg.toAgentID);

            UUID AgentID = msg.toAgentID;
            UUID GroupID = msg.imSessionID;

            switch (msg.dialog)
            {
                case (byte) InstantMessageDialog.SessionAdd:
                    ChatSession chatSession = m_groupData.GetSession(msg.imSessionID);
                    if (chatSession != null)
                    {
                        chatSession.Members.Add(new ChatSessionMember
                                                    {
                                                        AvatarKey = AgentID,
                                                        CanVoiceChat = false,
                                                        HasBeenAdded = true,
                                                        IsModerator = GetIsModerator(AgentID, GroupID),
                                                        MuteVoice = false,
                                                        MuteText = false
                                                    });
                    }
                    break;

                case (byte) InstantMessageDialog.SessionDrop:
                case 212:
                    DropMemberFromSession(GetActiveClient(AgentID), msg, false);
                    break;

                case 213: //Special for muting/unmuting a user
                    IClientAPI client = GetActiveClient(AgentID);
                    IEventQueueService eq = client.Scene.RequestModuleInterface<IEventQueueService>();
                    ChatSessionMember thismember = m_groupData.FindMember(msg.imSessionID, AgentID);
                    if (thismember == null)
                        return;
                    string[] brokenMessage = msg.message.Split(',');
                    bool mutedText = false, mutedVoice = false;
                    bool.TryParse(brokenMessage[0], out mutedText);
                    bool.TryParse(brokenMessage[1], out mutedVoice);
                    thismember.MuteText = mutedText;
                    thismember.MuteVoice = mutedVoice;
                    MuteUser(msg.imSessionID, eq, AgentID, thismember, false);
                    break;

                case (byte) InstantMessageDialog.SessionSend:
                    EnsureGroupChatIsStarted(msg.imSessionID); //Make sure one exists
                    ChatSession session = m_groupData.GetSession(msg.imSessionID);
                    if (session != null)
                    {
                        ChatSessionMember member = m_groupData.FindMember(msg.imSessionID, AgentID);
                        if (member.AvatarKey == AgentID && !member.MuteText)
                        {
                            IClientAPI msgclient = GetActiveClient(msg.toAgentID);
                            if (msgclient != null)
                            {
                                if (!member.HasBeenAdded)
                                    msgclient.Scene.RequestModuleInterface<IEventQueueService>().ChatterboxInvitation(
                                        session.SessionID
                                        , session.Name
                                        , msg.fromAgentID
                                        , msg.message
                                        , member.AvatarKey
                                        , msg.fromAgentName
                                        , msg.dialog
                                        , msg.timestamp
                                        , msg.offline == 1
                                        , (int) msg.ParentEstateID
                                        , msg.Position
                                        , 1
                                        , msg.imSessionID
                                        , true
                                        , Utils.StringToBytes(session.Name)
                                        , msgclient.Scene.RegionInfo.RegionHandle
                                        );
                                // Deliver locally, directly
                                if (m_debugEnabled)
                                    MainConsole.Instance.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} locally", msgclient.Name);
                                msgclient.SendInstantMessage(msg);
                            }
                        }
                    }
                    break;

                default:
                    MainConsole.Instance.WarnFormat("[GROUPS-MESSAGING]: I don't know how to proccess a {0} message.",
                                     ((InstantMessageDialog) msg.dialog).ToString());
                    break;
            }
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:92,代码来源:GroupsMessagingModule.cs

示例10: TriggerUnhandledInstantMessage

 public void TriggerUnhandledInstantMessage(GridInstantMessage message)
 {
     IncomingInstantMessage handlerUnhandledInstantMessage = OnUnhandledInstantMessage;
     if (handlerUnhandledInstantMessage != null)
     {
         foreach (IncomingInstantMessage d in handlerUnhandledInstantMessage.GetInvocationList())
         {
             try
             {
                 d(message);
             }
             catch (Exception e)
             {
                 MainConsole.Instance.ErrorFormat(
                     "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing.  {0} {1}",
                     e, e.StackTrace);
             }
         }
     }
 }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:20,代码来源:EventManager.cs

示例11: DebugGridInstantMessage

 private void DebugGridInstantMessage(GridInstantMessage im)
 {
     // Don't log any normal IMs (privacy!)
     if (m_debugEnabled && im.dialog != (byte) InstantMessageDialog.MessageFromAgent)
     {
         MainConsole.Instance.WarnFormat("[GROUPS-MESSAGING]: IM: fromGroup({0})", im.fromGroup ? "True" : "False");
         MainConsole.Instance.WarnFormat("[GROUPS-MESSAGING]: IM: Dialog({0})", ((InstantMessageDialog) im.dialog).ToString());
         MainConsole.Instance.WarnFormat("[GROUPS-MESSAGING]: IM: fromAgentID({0})", im.fromAgentID.ToString());
         MainConsole.Instance.WarnFormat("[GROUPS-MESSAGING]: IM: fromAgentName({0})", im.fromAgentName);
         MainConsole.Instance.WarnFormat("[GROUPS-MESSAGING]: IM: imSessionID({0})", im.imSessionID.ToString());
         MainConsole.Instance.WarnFormat("[GROUPS-MESSAGING]: IM: message({0})", im.message);
         MainConsole.Instance.WarnFormat("[GROUPS-MESSAGING]: IM: offline({0})", im.offline.ToString());
         MainConsole.Instance.WarnFormat("[GROUPS-MESSAGING]: IM: toAgentID({0})", im.toAgentID.ToString());
         MainConsole.Instance.WarnFormat("[GROUPS-MESSAGING]: IM: binaryBucket({0})",
                          Utils.BytesToHexString(im.binaryBucket, "BinaryBucket"));
     }
 }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:17,代码来源:GroupsMessagingModule.cs

示例12: LocalFriendshipApproved

        public bool LocalFriendshipApproved(UUID userID, string name, IClientAPI us, UUID friendID)
        {
            IClientAPI friendClient = LocateClientObject(friendID);
            if (friendClient != null)
            {
                //They are online, send the online message
                if (us != null)
                    us.SendAgentOnline(new[] {friendID});

                // the prospective friend in this sim as root agent
                GridInstantMessage im = new GridInstantMessage(m_Scenes[0], userID, name, friendID,
                                                               (byte) InstantMessageDialog.FriendshipAccepted,
                                                               userID.ToString(), false, Vector3.Zero);
                friendClient.SendInstantMessage(im);

                // Update the local cache
                UpdateFriendsCache(friendID);


                //
                // put a calling card into the inventory of the friend
                //
                ICallingCardModule ccmodule = friendClient.Scene.RequestModuleInterface<ICallingCardModule>();
                if (ccmodule != null)
                {
                    UserAccount account = friendClient.Scene.UserAccountService.GetUserAccount(UUID.Zero, userID);
                    UUID folderID =
                        friendClient.Scene.InventoryService.GetFolderForType(friendID, InventoryType.Unknown,
                                                                             AssetType.CallingCard).ID;
                    ccmodule.CreateCallingCard(friendClient, userID, folderID, account.Name);
                }
                // we're done
                return true;
            }

            return false;
        }
开发者ID:TechplexEngineer,项目名称:Aurora-Sim,代码行数:37,代码来源:FriendsModule.cs

示例13: BuildOfflineGroupNotice

 public GridInstantMessage BuildOfflineGroupNotice(GridInstantMessage msg)
 {
     msg.dialog = 211; //We set this so that it isn't taken the wrong way later
     //Unknown what this did...
     //UUID NoticeID = GroupSessionIDCache[msg.imSessionID];
     //GroupSessionIDCache.Remove(msg.imSessionID);
     //msg.imSessionID = NoticeID;
     return msg;
 }
开发者ID:BillyWarrhol,项目名称:Aurora-Sim,代码行数:9,代码来源:GroupsModule.cs

示例14: DropMemberFromSession

        /// <summary>
        ///   Remove the member from this session
        /// </summary>
        /// <param name = "client"></param>
        /// <param name = "im"></param>
        public void DropMemberFromSession(IClientAPI client, GridInstantMessage im)
        {
            ChatSession session;
            ChatSessions.TryGetValue(im.imSessionID, out session);
            if (session == null)
                return;
            ChatSessionMember member = new ChatSessionMember {AvatarKey = UUID.Zero};
#if (!ISWIN)
            foreach (ChatSessionMember testmember in session.Members)
            {
                if (testmember.AvatarKey == im.fromAgentID)
                {
                    member = testmember;
                }
            }
#else
            foreach (ChatSessionMember testmember in session.Members.Where(testmember => testmember.AvatarKey == im.fromAgentID))
            {
                member = testmember;
            }
#endif

            if (member.AvatarKey != UUID.Zero)
                session.Members.Remove(member);

            if (session.Members.Count == 0)
            {
                ChatSessions.Remove(session.SessionID);
                return;
            }

            ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block =
                new ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock
                    {
                        AgentID = member.AvatarKey,
                        CanVoiceChat = member.CanVoiceChat,
                        IsModerator = member.IsModerator,
                        MuteText = member.MuteText,
                        MuteVoice = member.MuteVoice,
                        Transition = "LEAVE"
                    };
            IEventQueueService eq = client.Scene.RequestModuleInterface<IEventQueueService>();
            foreach (ChatSessionMember sessionMember in session.Members)
            {
                eq.ChatterBoxSessionAgentListUpdates(session.SessionID, new[] {block}, sessionMember.AvatarKey, "LEAVE",
                                                     findScene(sessionMember.AvatarKey).RegionInfo.RegionHandle);
            }
        }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:53,代码来源:AuroraChatModule.cs

示例15: OnGridInstantMessage

 private void OnGridInstantMessage(GridInstantMessage msg)
 {
     OnInstantMessage(findScenePresence(msg.toAgentID).ControllingClient, msg);
 }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:4,代码来源:AuroraChatModule.cs


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