This class holds information about an avatar in the friends list. There are two ways to interface to this class. The first is through the set of boolean properties. This is the typical way clients of this class will use it. The second interface is through two bitflag properties, TheirFriendsRights and MyFriendsRights
コード例 #1
0
ファイル: FriendsManager.cs プロジェクト: scatterp/plexview
        /// <summary>
        /// Accept a friendship request
        /// </summary>
        /// <param name="fromAgentID">agentID of avatatar to form friendship with</param>
        /// <param name="imSessionID">imSessionID of the friendship request message</param>
        public void AcceptFriendship(UUID fromAgentID, UUID imSessionID)
        {
            UUID callingCardFolder = Client.Inventory.FindFolderForType(AssetType.CallingCard);

            AcceptFriendshipPacket request = new AcceptFriendshipPacket();

            request.AgentData.AgentID              = Client.Self.AgentID;
            request.AgentData.SessionID            = Client.Self.SessionID;
            request.TransactionBlock.TransactionID = imSessionID;
            request.FolderData             = new AcceptFriendshipPacket.FolderDataBlock[1];
            request.FolderData[0]          = new AcceptFriendshipPacket.FolderDataBlock();
            request.FolderData[0].FolderID = callingCardFolder;

            Client.Network.SendPacket(request);

            FriendInfo friend = new FriendInfo(fromAgentID, FriendRights.CanSeeOnline,
                                               FriendRights.CanSeeOnline);

            if (!FriendList.ContainsKey(fromAgentID))
            {
                FriendList.Add(friend.UUID, friend);
            }

            if (FriendRequests.ContainsKey(fromAgentID))
            {
                FriendRequests.Remove(fromAgentID);
            }

            Client.Avatars.RequestAvatarName(fromAgentID);
        }
コード例 #2
0
ファイル: FriendsManager.cs プロジェクト: scatterp/plexview
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void OnlineNotificationHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;

            if (packet.Type == PacketType.OnlineNotification)
            {
                OnlineNotificationPacket notification = ((OnlineNotificationPacket)packet);

                foreach (OnlineNotificationPacket.AgentBlockBlock block in notification.AgentBlock)
                {
                    FriendInfo friend;
                    lock (FriendList.Dictionary)
                    {
                        if (!FriendList.ContainsKey(block.AgentID))
                        {
                            friend = new FriendInfo(block.AgentID, FriendRights.CanSeeOnline,
                                                    FriendRights.CanSeeOnline);
                            FriendList.Add(block.AgentID, friend);
                        }
                        else
                        {
                            friend = FriendList[block.AgentID];
                        }
                    }

                    bool doNotify = !friend.IsOnline;
                    friend.IsOnline = true;

                    if (m_FriendOnline != null && doNotify)
                    {
                        OnFriendOnline(new FriendInfoEventArgs(friend));
                    }
                }
            }
        }
コード例 #3
0
ファイル: FriendsManager.cs プロジェクト: scatterp/plexview
        /// <summary>
        /// Populate FriendList <seealso cref="InternalDictionary"/> with data from the login reply
        /// </summary>
        /// <param name="loginSuccess">true if login was successful</param>
        /// <param name="redirect">true if login request is requiring a redirect</param>
        /// <param name="message">A string containing the response to the login request</param>
        /// <param name="reason">A string containing the reason for the request</param>
        /// <param name="replyData">A <seealso cref="LoginResponseData"/> object containing the decoded
        /// reply from the login server</param>
        private void Network_OnLoginResponse(bool loginSuccess, bool redirect, string message, string reason,
                                             LoginResponseData replyData)
        {
            int uuidLength = UUID.Zero.ToString().Length;

            if (loginSuccess && replyData.BuddyList != null)
            {
                foreach (BuddyListEntry buddy in replyData.BuddyList)
                {
                    UUID   bubid;
                    string id = buddy.buddy_id.Length > uuidLength?buddy.buddy_id.Substring(0, uuidLength) : buddy.buddy_id;

                    if (UUID.TryParse(id, out bubid))
                    {
                        lock (FriendList.Dictionary)
                        {
                            if (!FriendList.ContainsKey(bubid))
                            {
                                FriendList[bubid] = new FriendInfo(bubid,
                                                                   (FriendRights)buddy.buddy_rights_given,
                                                                   (FriendRights)buddy.buddy_rights_has);
                            }
                        }
                    }
                }
            }
        }
コード例 #4
0
ファイル: FriendsManager.cs プロジェクト: careytews/ALIVE
        /// <summary>
        /// Handle notifications sent when a friends has come online.
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="simulator"></param>
        private void OnlineNotificationHandler(Packet packet, Simulator simulator)
        {
            if (packet.Type == PacketType.OnlineNotification)
            {
                OnlineNotificationPacket notification = ((OnlineNotificationPacket)packet);

                foreach (OnlineNotificationPacket.AgentBlockBlock block in notification.AgentBlock)
                {
                    FriendInfo friend;

                    lock (FriendList)
                    {
                        if (!FriendList.ContainsKey(block.AgentID))
                        {
                            friend = new FriendInfo(block.AgentID, FriendRights.CanSeeOnline,
                                                    FriendRights.CanSeeOnline);
                            FriendList.Add(block.AgentID, friend);
                        }
                        else
                        {
                            friend = FriendList[block.AgentID];
                        }
                    }

                    bool doNotify = !friend.IsOnline;
                    friend.IsOnline = true;

                    if (OnFriendOnline != null && doNotify)
                    {
                        try { OnFriendOnline(friend); }
                        catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                    }
                }
            }
        }
コード例 #5
0
ファイル: FriendsManager.cs プロジェクト: scatterp/plexview
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void OfflineNotificationHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;

            if (packet.Type == PacketType.OfflineNotification)
            {
                OfflineNotificationPacket notification = (OfflineNotificationPacket)packet;

                foreach (OfflineNotificationPacket.AgentBlockBlock block in notification.AgentBlock)
                {
                    FriendInfo friend = new FriendInfo(block.AgentID, FriendRights.CanSeeOnline, FriendRights.CanSeeOnline);

                    lock (FriendList.Dictionary)
                    {
                        if (!FriendList.Dictionary.ContainsKey(block.AgentID))
                        {
                            FriendList.Dictionary[block.AgentID] = friend;
                        }

                        friend = FriendList.Dictionary[block.AgentID];
                    }

                    friend.IsOnline = false;

                    if (m_FriendOffline != null)
                    {
                        OnFriendOffline(new FriendInfoEventArgs(friend));
                    }
                }
            }
        }
コード例 #6
0
ファイル: FriendsManager.cs プロジェクト: careytews/ALIVE
 private void Network_OnLoginResponse(bool loginSuccess, bool redirect, string message, string reason,
                                      LoginResponseData replyData)
 {
     if (loginSuccess && replyData.BuddyList != null)
     {
         lock (FriendList)
         {
             for (int i = 0; i < replyData.BuddyList.Length; i++)
             {
                 FriendInfo friend = replyData.BuddyList[i];
                 FriendList[friend.UUID] = friend;
             }
         }
     }
 }
コード例 #7
0
ファイル: FriendsManager.cs プロジェクト: careytews/ALIVE
        /// <summary>
        /// Handles relevant messages from the server encapsulated in instant messages.
        /// </summary>
        /// <param name="im">InstantMessage object containing encapsalated instant message</param>
        /// <param name="simulator">Originating Simulator</param>
        private void MainAvatar_InstantMessage(InstantMessage im, Simulator simulator)
        {
            if (im.Dialog == InstantMessageDialog.FriendshipOffered)
            {
                if (OnFriendshipOffered != null)
                {
                    lock (FriendRequests)
                    {
                        if (FriendRequests.ContainsKey(im.FromAgentID))
                        {
                            FriendRequests[im.FromAgentID] = im.IMSessionID;
                        }
                        else
                        {
                            FriendRequests.Add(im.FromAgentID, im.IMSessionID);
                        }
                    }
                    try { OnFriendshipOffered(im.FromAgentID, im.FromAgentName, im.IMSessionID); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
            else if (im.Dialog == InstantMessageDialog.FriendshipAccepted)
            {
                FriendInfo friend = new FriendInfo(im.FromAgentID, FriendRights.CanSeeOnline,
                                                   FriendRights.CanSeeOnline);
                friend.Name = im.FromAgentName;
                lock (FriendList) FriendList[friend.UUID] = friend;

                if (OnFriendshipResponse != null)
                {
                    try { OnFriendshipResponse(im.FromAgentID, im.FromAgentName, true); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
            else if (im.Dialog == InstantMessageDialog.FriendshipDeclined)
            {
                if (OnFriendshipResponse != null)
                {
                    try { OnFriendshipResponse(im.FromAgentID, im.FromAgentName, false); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
        }
コード例 #8
0
ファイル: FriendsManager.cs プロジェクト: scatterp/plexview
        private void Self_IM(object sender, InstantMessageEventArgs e)
        {
            if (e.IM.Dialog == InstantMessageDialog.FriendshipOffered)
            {
                if (m_FriendshipOffered != null)
                {
                    if (FriendRequests.ContainsKey(e.IM.FromAgentID))
                    {
                        FriendRequests[e.IM.FromAgentID] = e.IM.IMSessionID;
                    }
                    else
                    {
                        FriendRequests.Add(e.IM.FromAgentID, e.IM.IMSessionID);
                    }

                    OnFriendshipOffered(new FriendshipOfferedEventArgs(e.IM.FromAgentID, e.IM.FromAgentName, e.IM.IMSessionID));
                }
            }
            else if (e.IM.Dialog == InstantMessageDialog.FriendshipAccepted)
            {
                FriendInfo friend = new FriendInfo(e.IM.FromAgentID, FriendRights.CanSeeOnline,
                                                   FriendRights.CanSeeOnline);
                friend.Name = e.IM.FromAgentName;
                lock (FriendList.Dictionary) FriendList[friend.UUID] = friend;

                if (m_FriendshipResponse != null)
                {
                    OnFriendshipResponse(new FriendshipResponseEventArgs(e.IM.FromAgentID, e.IM.FromAgentName, true));
                }
                RequestOnlineNotification(e.IM.FromAgentID);
            }
            else if (e.IM.Dialog == InstantMessageDialog.FriendshipDeclined)
            {
                if (m_FriendshipResponse != null)
                {
                    OnFriendshipResponse(new FriendshipResponseEventArgs(e.IM.FromAgentID, e.IM.FromAgentName, false));
                }
            }
        }
コード例 #9
0
        /// <summary>
        /// Populate FriendList <seealso cref="InternalDictionary"/> with data from the login reply
        /// </summary>
        /// <param name="loginSuccess">true if login was successful</param>
        /// <param name="redirect">true if login request is requiring a redirect</param>
        /// <param name="message">A string containing the response to the login request</param>
        /// <param name="reason">A string containing the reason for the request</param>
        /// <param name="replyData">A <seealso cref="LoginResponseData"/> object containing the decoded 
        /// reply from the login server</param>
        private void Network_OnLoginResponse(bool loginSuccess, bool redirect, string message, string reason,
            LoginResponseData replyData)
        {
            int uuidLength = UUID.Zero.ToString().Length;

            if (loginSuccess && replyData.BuddyList != null)
            {
                foreach (BuddyListEntry buddy in replyData.BuddyList)
                {
                    UUID bubid;
                    string id = buddy.buddy_id.Length > uuidLength ? buddy.buddy_id.Substring(0, uuidLength) : buddy.buddy_id;
                    if (UUID.TryParse(id, out bubid))
                    {
                        lock (FriendList.Dictionary)
                        {
                            if (!FriendList.ContainsKey(bubid))
                            {
                                FriendList[bubid] = new FriendInfo(bubid,
                                    (FriendRights)buddy.buddy_rights_given,
                                    (FriendRights)buddy.buddy_rights_has);
                            }
                        }
                    }
                }
            }
        }
コード例 #10
0
        /// <summary>
        /// Handle notifications sent when a friends has come online.
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="simulator"></param>
        private void OnlineNotificationHandler(Packet packet, Simulator simulator)
        {
            if (packet.Type == PacketType.OnlineNotification)
            {
                OnlineNotificationPacket notification = ((OnlineNotificationPacket)packet);

                foreach (OnlineNotificationPacket.AgentBlockBlock block in notification.AgentBlock)
                {
                    FriendInfo friend;

                    lock (FriendList)
                    {
                        if (!FriendList.ContainsKey(block.AgentID))
                        {
                            friend = new FriendInfo(block.AgentID, FriendRights.CanSeeOnline,
                                FriendRights.CanSeeOnline);
                            FriendList.Add(block.AgentID, friend);
                        }
                        else
                        {
                            friend = FriendList[block.AgentID];
                        }
                    }

                    bool doNotify = !friend.IsOnline;
                    friend.IsOnline = true;

                    if (OnFriendOnline != null && doNotify)
                    {
                        try { OnFriendOnline(friend); }
                        catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                    }
                }
            }
        }
コード例 #11
0
ファイル: Dashboard.cs プロジェクト: RavenB/gridsearch
 private void friendsList1_OnFriendDoubleClick(FriendInfo friend)
 {
     MessageBox.Show(friend.Name + " = " + friend.UUID);
 }
コード例 #12
0
        private void SetFriend(FriendInfo friend)
        {
            //if (InvokeRequired)
            //{
            //    BeginInvoke(new MethodInvoker(() => SetFriend(friend)));
            //    return;
            //}

            try
            {
                if (friend == null) return;

                if (cbofgroups.SelectedIndex > 0)
                {
                    button2.Visible = true;
                    button2.Enabled = true;
                }
                else
                {
                    button2.Visible = false;
                    button2.Enabled = false;
                }

                selectedFriend = friend;

                lblFriendName.Text = friend.Name + (friend.IsOnline ? " (online)" : " (offline)");

                btnRemove.Enabled = btnIM.Enabled = btnProfile.Enabled = btnOfferTeleport.Enabled = btnPay.Enabled = true;
                chkSeeMeOnline.Enabled = chkSeeMeOnMap.Enabled = chkModifyMyObjects.Enabled = true;
                chkSeeMeOnMap.Enabled = friend.CanSeeMeOnline;

                settingFriend = true;
                chkSeeMeOnline.Checked = friend.CanSeeMeOnline;
                chkSeeMeOnMap.Checked = friend.CanSeeMeOnMap;
                chkModifyMyObjects.Checked = friend.CanModifyMyObjects;
                settingFriend = false;
            }
            catch { ; }
        }
コード例 #13
0
        /// <summary>
        /// Handles relevant messages from the server encapsulated in instant messages.
        /// </summary>
        /// <param name="im">InstantMessage object containing encapsalated instant message</param>
        /// <param name="simulator">Originating Simulator</param>
        private void MainAvatar_InstantMessage(InstantMessage im, Simulator simulator)
        {
            if (im.Dialog == InstantMessageDialog.FriendshipOffered)
            {
                if (OnFriendshipOffered != null)
                {
                    lock (FriendRequests)
                    {
                        if (FriendRequests.ContainsKey(im.FromAgentID))
                            FriendRequests[im.FromAgentID] = im.IMSessionID;
                        else
                            FriendRequests.Add(im.FromAgentID, im.IMSessionID);
                    }
                    try { OnFriendshipOffered(im.FromAgentID, im.FromAgentName, im.IMSessionID); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
            else if (im.Dialog == InstantMessageDialog.FriendshipAccepted)
            {
                FriendInfo friend = new FriendInfo(im.FromAgentID, FriendRights.CanSeeOnline,
                    FriendRights.CanSeeOnline);
                friend.Name = im.FromAgentName;
                lock (FriendList) FriendList[friend.UUID] = friend;

                if (OnFriendshipResponse != null)
                {
                    try { OnFriendshipResponse(im.FromAgentID, im.FromAgentName, true); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
            else if (im.Dialog == InstantMessageDialog.FriendshipDeclined)
            {
                if (OnFriendshipResponse != null)
                {
                    try { OnFriendshipResponse(im.FromAgentID, im.FromAgentName, false); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// Accept a friendship request
        /// </summary>
        /// <param name="fromAgentID">agentID of avatatar to form friendship with</param>
        /// <param name="imSessionID">imSessionID of the friendship request message</param>
        public void AcceptFriendship(UUID fromAgentID, UUID imSessionID)
        {
            UUID callingCardFolder = Client.Inventory.FindFolderForType(AssetType.CallingCard);

            AcceptFriendshipPacket request = new AcceptFriendshipPacket();
            request.AgentData.AgentID = Client.Self.AgentID;
            request.AgentData.SessionID = Client.Self.SessionID;
            request.TransactionBlock.TransactionID = imSessionID;
            request.FolderData = new AcceptFriendshipPacket.FolderDataBlock[1];
            request.FolderData[0] = new AcceptFriendshipPacket.FolderDataBlock();
            request.FolderData[0].FolderID = callingCardFolder;

            Client.Network.SendPacket(request);

            FriendInfo friend = new FriendInfo(fromAgentID, FriendRights.CanSeeOnline,
                FriendRights.CanSeeOnline);

            if (!FriendList.ContainsKey(fromAgentID))
                FriendList.Add(friend.UUID, friend);

            if (FriendRequests.ContainsKey(fromAgentID))
                FriendRequests.Remove(fromAgentID);

            Client.Avatars.RequestAvatarName(fromAgentID);
        }
コード例 #15
0
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void OnlineNotificationHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;
            if (packet.Type == PacketType.OnlineNotification)
            {
                OnlineNotificationPacket notification = ((OnlineNotificationPacket)packet);

                foreach (OnlineNotificationPacket.AgentBlockBlock block in notification.AgentBlock)
                {
                    FriendInfo friend;
                    lock (FriendList.Dictionary)
                    {
                        if (!FriendList.ContainsKey(block.AgentID))
                        {
                            friend = new FriendInfo(block.AgentID, FriendRights.CanSeeOnline,
                                FriendRights.CanSeeOnline);
                            FriendList.Add(block.AgentID, friend);
                        }
                        else
                        {
                            friend = FriendList[block.AgentID];
                        }
                    }

                    bool doNotify = !friend.IsOnline;
                    friend.IsOnline = true;

                    if (m_FriendOnline != null && doNotify)
                    {
                        OnFriendOnline(new FriendInfoEventArgs(friend));
                    }
                }
            }
        }
コード例 #16
0
ファイル: FriendsConsole.cs プロジェクト: Nuriat/radegast
 private void listFriends_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedFriend = (FriendInfo)listFriends.SelectedItem;
     SetControls();
 }
コード例 #17
0
ファイル: Display.cs プロジェクト: cobain861/ghettosl
 /// <summary>
 /// Friend is online
 /// </summary>
 public static void FriendOnline(uint sessionNum, FriendInfo friend)
 {
     string name = "(unknown)";
     if (friend.Name == "") name = friend.Name;
     SetColor(ConsoleColor.DarkYellow);
     Console.Write(SessionPrefix(sessionNum));
     SetColor(ConsoleColor.Yellow);
     Console.Write(name + " is online." + Environment.NewLine);
     SetColor(ConsoleColor.Gray);
 }
コード例 #18
0
ファイル: Login.cs プロジェクト: careytews/ALIVE
        public void Parse(OSDMap reply)
        {
            try
            {
                AgentID         = ParseUUID("agent_id", reply);
                SessionID       = ParseUUID("session_id", reply);
                SecureSessionID = ParseUUID("secure_session_id", reply);
                FirstName       = ParseString("first_name", reply).Trim('"');
                LastName        = ParseString("last_name", reply).Trim('"');
                StartLocation   = ParseString("start_location", reply);
                AgentAccess     = ParseString("agent_access", reply);
                LookAt          = ParseVector3("look_at", reply);
            }
            catch (OSDException e)
            {
                Logger.DebugLog("Login server returned (some) invalid data: " + e.Message);
            }

            // Home
            OSDMap home    = null;
            OSD    osdHome = OSDParser.DeserializeLLSDNotation(reply["home"].AsString());

            if (osdHome.Type == OSDType.Map)
            {
                home = (OSDMap)osdHome;

                OSD homeRegion;
                if (home.TryGetValue("region_handle", out homeRegion) && homeRegion.Type == OSDType.Array)
                {
                    OSDArray homeArray = (OSDArray)homeRegion;
                    if (homeArray.Count == 2)
                    {
                        HomeRegion = Utils.UIntsToLong((uint)homeArray[0].AsInteger(), (uint)homeArray[1].AsInteger());
                    }
                    else
                    {
                        HomeRegion = 0;
                    }
                }

                HomePosition = ParseVector3("position", home);
                HomeLookAt   = ParseVector3("look_at", home);
            }
            else
            {
                HomeRegion   = 0;
                HomePosition = Vector3.Zero;
                HomeLookAt   = Vector3.Zero;
            }

            CircuitCode = ParseUInt("circuit_code", reply);
            RegionX     = ParseUInt("region_x", reply);
            RegionY     = ParseUInt("region_y", reply);
            SimPort     = (ushort)ParseUInt("sim_port", reply);
            string simIP = ParseString("sim_ip", reply);

            IPAddress.TryParse(simIP, out SimIP);
            SeedCapability = ParseString("seed_capability", reply);

            // Buddy list
            OSD buddyLLSD;

            if (reply.TryGetValue("buddy-list", out buddyLLSD) && buddyLLSD.Type == OSDType.Array)
            {
                OSDArray buddyArray = (OSDArray)buddyLLSD;
                BuddyList = new FriendInfo[buddyArray.Count];

                for (int i = 0; i < buddyArray.Count; i++)
                {
                    if (buddyArray[i].Type == OSDType.Map)
                    {
                        OSDMap buddy = (OSDMap)buddyArray[i];
                        BuddyList[i] = new FriendInfo(
                            ParseUUID("buddy_id", buddy),
                            (FriendRights)ParseUInt("buddy_rights_given", buddy),
                            (FriendRights)ParseUInt("buddy_rights_has", buddy));
                    }
                }
            }

            SecondsSinceEpoch = Utils.UnixTimeToDateTime(ParseUInt("seconds_since_epoch", reply));
            InventoryRoot     = ParseMappedUUID("inventory-root", "folder_id", reply);
            InventorySkeleton = ParseInventoryFolders("inventory-skeleton", AgentID, reply);
            LibraryRoot       = ParseMappedUUID("inventory-lib-root", "folder_id", reply);
            LibraryOwner      = ParseMappedUUID("inventory-lib-owner", "agent_id", reply);
            LibrarySkeleton   = ParseInventoryFolders("inventory-skel-lib", LibraryOwner, reply);
        }
コード例 #19
0
 public FriendsListItem(FriendInfo friend)
 {
     this.friend = friend;
 }
コード例 #20
0
ファイル: FriendsManager.cs プロジェクト: scatterp/plexview
 /// <summary>
 /// Construct a new instance of the FriendInfoEventArgs class
 /// </summary>
 /// <param name="friend">The FriendInfo</param>
 public FriendInfoEventArgs(FriendInfo friend)
 {
     this.m_Friend = friend;
 }
コード例 #21
0
        FriendRights getrights(FriendInfo finfo)
        {
            FriendRights rights=new FriendRights();
            rights=0;

            if(finfo.CanModifyMyObjects)
                rights|=FriendRights.CanModifyObjects;

            if(finfo.CanSeeMeOnMap)
                rights|=FriendRights.CanSeeOnMap;

            if(finfo.CanSeeMeOnline)
                rights|=FriendRights.CanSeeOnline;

            return rights;
        }
コード例 #22
0
ファイル: MapConsole.cs プロジェクト: niel/radegast
 private void ddOnlineFriends_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddOnlineFriends.SelectedIndex < 1) return;
     mapFriend = client.Friends.FriendList.Find((FriendInfo f) => { return f.Name == ddOnlineFriends.SelectedItem.ToString(); });
     if (mapFriend != null)
     {
         targetRegionHandle = 0;
         client.Friends.MapFriend(mapFriend.UUID);
     }
 }
コード例 #23
0
        private void Self_IM(object sender, InstantMessageEventArgs e)
        {
            if (e.IM.Dialog == InstantMessageDialog.FriendshipOffered)
            {
                if (m_FriendshipOffered != null)
                {
                    if (FriendRequests.ContainsKey(e.IM.FromAgentID))
                        FriendRequests[e.IM.FromAgentID] = e.IM.IMSessionID;
                    else
                        FriendRequests.Add(e.IM.FromAgentID, e.IM.IMSessionID);

                    OnFriendshipOffered(new FriendshipOfferedEventArgs(e.IM.FromAgentID, e.IM.FromAgentName, e.IM.IMSessionID));
                }
            }
            else if (e.IM.Dialog == InstantMessageDialog.FriendshipAccepted)
            {
                FriendInfo friend = new FriendInfo(e.IM.FromAgentID, FriendRights.CanSeeOnline,
                    FriendRights.CanSeeOnline);
                friend.Name = e.IM.FromAgentName;
                lock (FriendList.Dictionary) FriendList[friend.UUID] = friend;

                if (m_FriendshipResponse != null)
                {
                    OnFriendshipResponse(new FriendshipResponseEventArgs(e.IM.FromAgentID, e.IM.FromAgentName, true));
                }
                RequestOnlineNotification(e.IM.FromAgentID);
            }
            else if (e.IM.Dialog == InstantMessageDialog.FriendshipDeclined)
            {
                if (m_FriendshipResponse != null)
                {
                    OnFriendshipResponse(new FriendshipResponseEventArgs(e.IM.FromAgentID, e.IM.FromAgentName, false));
                }
            }
        }
コード例 #24
0
ファイル: Callbacks.cs プロジェクト: cobain861/ghettosl
 void Friends_OnFriendOnline(FriendInfo friend)
 {
     Display.FriendOnline(Session.SessionNumber, friend);
 }
コード例 #25
0
 /// <summary>
 /// Construct a new instance of the FriendInfoEventArgs class
 /// </summary>
 /// <param name="friend">The FriendInfo</param>
 public FriendInfoEventArgs(FriendInfo friend)
 {
     this.m_Friend = friend;
 }
コード例 #26
0
ファイル: Login.cs プロジェクト: RavenB/gridsearch
        public void Parse(LLSDMap reply)
        {
            try
            {
                AgentID = ParseUUID("agent_id", reply);
                SessionID = ParseUUID("session_id", reply);
                SecureSessionID = ParseUUID("secure_session_id", reply);
                FirstName = ParseString("first_name", reply).Trim('"');
                LastName = ParseString("last_name", reply).Trim('"');
                StartLocation = ParseString("start_location", reply);
                AgentAccess = ParseString("agent_access", reply);
                LookAt = ParseVector3("look_at", reply); 
            }
            catch (LLSDException e)
            {
                // FIXME: sometimes look_at comes back with invalid values e.g: 'look_at':'[r1,r2.0193899999999998204e-06,r0]'
                // need to handle that somehow
                Logger.DebugLog("login server returned (some) invalid data: " + e.Message);
            }

            // Home
            LLSDMap home = null;
            LLSD llsdHome = LLSDParser.DeserializeNotation(reply["home"].AsString());

            if (llsdHome.Type == LLSDType.Map)
            {
                home = (LLSDMap)llsdHome;

                LLSD homeRegion;
                if (home.TryGetValue("region_handle", out homeRegion) && homeRegion.Type == LLSDType.Array)
                {
                    LLSDArray homeArray = (LLSDArray)homeRegion;
                    if (homeArray.Count == 2)
                        HomeRegion = Helpers.UIntsToLong((uint)homeArray[0].AsInteger(), (uint)homeArray[1].AsInteger());
                    else
                        HomeRegion = 0;
                }

                HomePosition = ParseVector3("position", home);
                HomeLookAt = ParseVector3("look_at", home);
            }
            else
            {
                HomeRegion = 0;
                HomePosition = Vector3.Zero;
                HomeLookAt = Vector3.Zero;
            }

            CircuitCode = ParseUInt("circuit_code", reply);
            RegionX = ParseUInt("region_x", reply);
            RegionY = ParseUInt("region_y", reply);
            SimPort = (ushort)ParseUInt("sim_port", reply);
            string simIP = ParseString("sim_ip", reply);
            IPAddress.TryParse(simIP, out SimIP);
            SeedCapability = ParseString("seed_capability", reply);

            // Buddy list
            LLSD buddyLLSD;
            if (reply.TryGetValue("buddy-list", out buddyLLSD) && buddyLLSD.Type == LLSDType.Array)
            {
                LLSDArray buddyArray = (LLSDArray)buddyLLSD;
                BuddyList = new FriendInfo[buddyArray.Count];

                for (int i = 0; i < buddyArray.Count; i++)
                {
                    if (buddyArray[i].Type == LLSDType.Map)
                    {
                        LLSDMap buddy = (LLSDMap)buddyArray[i];
                        BuddyList[i] = new FriendInfo(
                            ParseUUID("buddy_id", buddy),
                            (FriendRights)ParseUInt("buddy_rights_given", buddy),
                            (FriendRights)ParseUInt("buddy_rights_has", buddy));
                    }
                }
            }

            SecondsSinceEpoch = Helpers.UnixTimeToDateTime(ParseUInt("seconds_since_epoch", reply));
            InventoryRoot = ParseMappedUUID("inventory-root", "folder_id", reply);
            InventoryFolders = ParseInventoryFolders("inventory-skeleton", AgentID, reply);
            LibraryRoot = ParseMappedUUID("inventory-lib-root", "folder_id", reply);
            LibraryOwner = ParseMappedUUID("inventory-lib-owner", "agent_id", reply);
            LibraryFolders = ParseInventoryFolders("inventory-skel-lib", LibraryOwner, reply);
        }
コード例 #27
0
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void OfflineNotificationHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;
            if (packet.Type == PacketType.OfflineNotification)
            {
                OfflineNotificationPacket notification = (OfflineNotificationPacket)packet;

                foreach (OfflineNotificationPacket.AgentBlockBlock block in notification.AgentBlock)
                {
                    FriendInfo friend = new FriendInfo(block.AgentID, FriendRights.CanSeeOnline, FriendRights.CanSeeOnline);

                    lock (FriendList.Dictionary)
                    {
                        if (!FriendList.Dictionary.ContainsKey(block.AgentID))
                            FriendList.Dictionary[block.AgentID] = friend;

                        friend = FriendList.Dictionary[block.AgentID];
                    }

                    friend.IsOnline = false;

                    if (m_FriendOffline != null)
                    {
                        OnFriendOffline(new FriendInfoEventArgs(friend));
                    }
                }
            }
        }
コード例 #28
0
ファイル: Dashboard.cs プロジェクト: RavenB/gridsearch
 void friendsList1_OnFriendDoubleClick(FriendInfo friend)
 {
     messageBar1.CreateSession(friend.Name, friend.UUID, friend.UUID, true);
 }
コード例 #29
0
ファイル: FriendsConsole.cs プロジェクト: Nuriat/radegast
        private void btnIM_Click(object sender, EventArgs e)
        {
            if (listFriends.SelectedItems.Count == 1)
            {
                selectedFriend = (FriendInfo)listFriends.SelectedItems[0];
                instance.TabConsole.ShowIMTab(selectedFriend.UUID, selectedFriend.Name, true);
            }
            else if (listFriends.SelectedItems.Count > 1)
            {
                List<UUID> participants = new List<UUID>();
                foreach (var item in listFriends.SelectedItems)
                    participants.Add(((FriendInfo)item).UUID);
                UUID tmpID = UUID.Random();
                lblFriendName.Text = "Startings friends conference...";
                instance.TabConsole.DisplayNotificationInChat(lblFriendName.Text, ChatBufferTextStyle.Invisible);
                btnIM.Enabled = false;

                ThreadPool.QueueUserWorkItem(sync =>
                    {
                        using (ManualResetEvent started = new ManualResetEvent(false))
                        {
                            UUID sessionID = UUID.Zero;
                            string sessionName = string.Empty;

                            EventHandler<GroupChatJoinedEventArgs> handler = (object isender, GroupChatJoinedEventArgs ie) =>
                                {
                                    if (ie.TmpSessionID == tmpID)
                                    {
                                        sessionID = ie.SessionID;
                                        sessionName = ie.SessionName;
                                        started.Set();
                                    }
                                };

                            client.Self.GroupChatJoined += handler;
                            client.Self.StartIMConference(participants, tmpID);
                            if (started.WaitOne(30 * 1000, false))
                            {
                                instance.TabConsole.BeginInvoke(new MethodInvoker(() =>
                                    {
                                        instance.TabConsole.AddConferenceIMTab(sessionID, sessionName);
                                        instance.TabConsole.SelectTab(sessionID.ToString());
                                    }
                                ));
                            }
                            client.Self.GroupChatJoined -= handler;
                            BeginInvoke(new MethodInvoker(() => RefreshFriendsList()));
                        }
                    }
                );
            }
        }
コード例 #30
0
ファイル: AnimDetail.cs プロジェクト: niel/radegast
 private void cbFriends_SelectedValueChanged(object sender, EventArgs e)
 {
     if (cbFriends.SelectedIndex >= 0)
     {
         btnSend.Enabled = true;
         friend = friends[cbFriends.SelectedIndex];
     }
     else
     {
         btnSend.Enabled = false;
     }
 }
コード例 #31
0
ファイル: SLProtocol.cs プロジェクト: caocao/3di-viewer-rei
 private void Friends_OnFriendOnline(FriendInfo friend)
 {
     if (OnFriendsListChanged != null)
     {
         OnFriendsListChanged();
     }
 }
コード例 #32
0
 private void Friends_OnFriendOnline(FriendInfo friend)
 {
     if (OnFriendsListUpdate != null)
     {
         OnFriendsListUpdate();
     }
 }