//
        // These 2 are for local and foreign users coming back, respectively
        //

        private void ProcessInventoryForComingHome(IClientAPI client)
        {
            m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: Restoring root folder for local user {0}", client.Name);
            if (client is IClientCore)
            {
                IClientCore      core = (IClientCore)client;
                IClientInventory inv;

                if (core.TryGet <IClientInventory>(out inv))
                {
                    InventoryFolderBase root    = m_Scene.InventoryService.GetRootFolder(client.AgentId);
                    InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID);

                    List <InventoryFolderBase> keep = new List <InventoryFolderBase>();

                    foreach (InventoryFolderBase f in content.Folders)
                    {
                        if (f.Name != "My Suitcase" && f.Name != "Current Outfit")
                        {
                            keep.Add(f);
                        }
                    }

                    inv.SendBulkUpdateInventory(keep.ToArray(), content.Items.ToArray());
                }
            }
        }
Example #2
0
        private void ClientConnectHandler(IClientCore clientCore)
        {
            if (clientCore is IClientAPI)
            {
                IClientAPI client = (IClientAPI)clientCore;

                // Classifieds
                client.AddGenericPacketHandler("avatarclassifiedsrequest", AvatarClassifiedsRequestHandler);
                client.OnClassifiedInfoRequest += ClassifiedInfoRequestHandler;
                client.OnClassifiedInfoUpdate  += ClassifiedInfoUpdateHandler;
                client.OnClassifiedDelete      += ClassifiedDeleteHandler;

                // Picks
                client.AddGenericPacketHandler("avatarpicksrequest", HandleAvatarPicksRequest);
                client.AddGenericPacketHandler("pickinforequest", HandlePickInfoRequest);
                client.OnPickInfoUpdate += PickInfoUpdateHandler;
                client.OnPickDelete     += PickDeleteHandler;

                // Notes
                client.AddGenericPacketHandler("avatarnotesrequest", HandleAvatarNotesRequest);
                client.OnAvatarNotesUpdate += AvatarNotesUpdateHandler;

                // Profiles
                client.OnRequestAvatarProperties += RequestAvatarPropertiesHandler;

                client.OnUpdateAvatarProperties += UpdateAvatarPropertiesHandler;
                client.OnAvatarInterestUpdate   += AvatarInterestUpdateHandler;
                client.OnUserInfoRequest        += UserInfoRequestHandler;
                client.OnUpdateUserInfo         += UpdateUserInfoHandler;
            }
        }
Example #3
0
        /// -----------------------------------------------------------------
        /// <summary>
        /// </summary>
        // -----------------------------------------------------------------
        private void CleanCurrentOutfitFolder(ScenePresence sp)
        {
            IInventoryService iservice = m_scene.InventoryService;
            InventoryFolderBase folder = iservice.GetFolderForType(sp.UUID,AssetType.CurrentOutfitFolder);
            if (folder == null)
            {
                m_log.WarnFormat("[AvatarHandlers] Unable to find current outfit folder for {0}",sp.UUID);
                return;
            }
            
            InventoryCollection contents = iservice.GetFolderContent(sp.UUID,folder.ID);
            if (contents == null)
            {
                m_log.WarnFormat("[AvatarHandlers] Unable to retrieve current outfit contents");
                return;
            }

            List<UUID> items = new List<UUID>();
            foreach (InventoryItemBase item in contents.Items)
                items.Add(item.ID);
            
            // Delete the items from the Current Outfit inventory folder
            iservice.DeleteItems(sp.UUID,items);
            
            IClientCore core = (IClientCore)sp.ControllingClient;
            IClientInventory inv;
            
            if (core.TryGet<IClientInventory>(out inv))
                inv.SendRemoveInventoryItems(items.ToArray());
        }
Example #4
0
        void EventManager_OnClientConnect(IClientCore client)
        {
            // Only need to run through all this if there are entries in the ban list
            if (bans.Count > 0)
            {                
                IClientIPEndpoint ipEndpoint;
                if (client.TryGet(out ipEndpoint))
                {
                    IPAddress end = ipEndpoint.EndPoint;

                    try
                    {
                        IPHostEntry rDNS = Dns.GetHostEntry(end);
                        foreach (string ban in bans)
                        {
                            if (rDNS.HostName.Contains(ban) ||
                                end.ToString().StartsWith(ban))
                            {
                                client.Disconnect("Banned - network \"" + ban + "\" is not allowed to connect to this server.");
                                m_log.Warn("[IPBAN] Disconnected '" + end + "' due to '" + ban + "' ban.");
                                return;
                            }
                        }
                    }
                    catch (System.Net.Sockets.SocketException)
                    {
                        m_log.WarnFormat("[IPBAN] IP address \"{0}\" cannot be resolved via DNS", end);
                    }
                    // m_log.DebugFormat("[IPBAN] User \"{0}\" not in any ban lists. Allowing connection.", end);
                }
            }
        }
Example #5
0
        void EventManager_OnClientConnect(IClientCore client)
        {
            IClientIPEndpoint ipEndpoint;

            if (client.TryGet(out ipEndpoint))
            {
                IPAddress end = ipEndpoint.EndPoint;

                try
                {
                    IPHostEntry rDNS = Dns.GetHostEntry(end);
                    foreach (string ban in bans)
                    {
                        if (rDNS.HostName.Contains(ban) ||
                            end.ToString().StartsWith(ban))
                        {
                            client.Disconnect("Banned - network \"" + ban + "\" is not allowed to connect to this server.");
                            m_log.Warn("[IPBAN] Disconnected '" + end + "' due to '" + ban + "' ban.");
                            return;
                        }
                    }
                }
                catch (System.Net.Sockets.SocketException sex)
                {
                    m_log.WarnFormat("[IPBAN] IP address \"{0}\" cannot be resolved via DNS", end);
                }
                m_log.WarnFormat("[IPBAN] User \"{0}\" not in any ban lists. Allowing connection.", end);
            }
        }
 void OnClientConnect(IClientCore client)
 {
     IClientIM clientIM;
     if (client.TryGet(out clientIM))
     {
         clientIM.OnInstantMessage += OnInstantMessage;
     }
 }
        protected virtual void OnClientConnect(IClientCore client)
        {
            IClientIM clientIM;

            if (client.TryGet(out clientIM))
            {
                clientIM.OnInstantMessage += OnInstantMessage;
            }
        }
        private void OnClientConnect(IClientCore client)
        {
            IClientIM clientIM;

            if (client.TryGet(out clientIM))
            {
                clientIM.OnInstantMessage += OnInstantMessage;
            }
        }
Example #9
0
 static void Instance_ReconnectWithError(IClientCore a, int errorCode)
 {
     if (errorCode == 10061)
     {
         Console.WriteLine("Client Error. Connection refused. No Server applicaiton running.");
         Console.WriteLine("Wait and try to reconnect after 5 sec..");
     }
     else if (errorCode == 10054)
     {
         Console.WriteLine("Client lost connection with Server");
         Console.WriteLine("Try to reconnect after 5 sec..");
     }
 }
        //
        // These 2 are for local and foreign users coming back, respectively
        //

        private void ProcessInventoryForComingHome(IClientAPI client)
        {
            m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: Restoring root folder for local user {0}", client.Name);
            if (client is IClientCore)
            {
                IClientCore      core = (IClientCore)client;
                IClientInventory inv;

                if (core.TryGet <IClientInventory>(out inv))
                {
                    InventoryFolderBase root    = m_Scene.InventoryService.GetRootFolder(client.AgentId);
                    InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID);

                    inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray());
                }
            }
        }
Example #11
0
        /// -----------------------------------------------------------------
        /// <summary>
        /// </summary>
        // -----------------------------------------------------------------
        private void AddWearablesToCurrentOutfitFolder(ScenePresence sp)
        {
            IInventoryService   iservice = m_scene.InventoryService;
            InventoryFolderBase folder   = iservice.GetFolderForType(sp.UUID, FolderType.CurrentOutfit);

            if (folder == null)
            {
                m_log.WarnFormat("[AvatarHandlers] Unable to find current outfit folder for {0}", sp.UUID);
                return;
            }

            List <InventoryItemBase> items = new List <InventoryItemBase>();

            for (int i = 0; i < AvatarWearable.LEGACY_VERSION_MAX_WEARABLES; i++)
            {
                for (int j = 0; j < sp.Appearance.Wearables[i].Count; j++)
                {
                    // trying to create links.. this could go horribly wrong
                    InventoryItemBase item = new InventoryItemBase(sp.Appearance.Wearables[i][j].ItemID, sp.UUID);

                    // Fill in the rest of the details from the current item
                    item = iservice.GetItem(item);

                    // And morph it into a link, it appears that the asset is really a reference to another
                    // inventory item
                    item.AssetID = item.ID;
                    item.ID      = UUID.Random();
                    item.Folder  = folder.ID;
                    items.Add(item);

                    iservice.AddItem(item);
                }
            }

            // Add the items from the Current Outfit inventory folder
            IClientCore      core = (IClientCore)sp.ControllingClient;
            IClientInventory inv;

            if (core.TryGet <IClientInventory>(out inv))
            {
                inv.SendBulkUpdateInventory(new InventoryFolderBase[] { folder }, items.ToArray());
            }
        }
Example #12
0
        void EventManager_OnClientConnect(IClientCore client)
        {
            IClientIPEndpoint ipEndpoint;
            if(client.TryGet(out ipEndpoint))
            {
                IPAddress end = ipEndpoint.EndPoint;

                foreach (string ban in bans)
                {
                    if (end.ToString().StartsWith(ban))
                    {
                        client.Disconnect("Banned - network \"" + ban + "\" is not allowed to connect to this server.");
                        m_log.Warn("[IPBAN] Disconnected '" + end + "' due to '" + ban + "' ban.");
                        return;
                    }
                }

                //m_log.InfoFormat("[IPBAN] User \"{0}\" not in any ban lists. Allowing connection.", end);
            }
        }
Example #13
0
        static void Instance_MessageReceived(IClientCore a, OrderItem orderItem)
        {
            switch (orderItem.CommandType)
            {
            case CommandTypeEnum.ResponsePrice:
                Console.WriteLine("Currency Type: {0}", orderItem.CurrencyType);
                Console.WriteLine("Server responsed Price: {0}", orderItem.Price);
                Console.WriteLine("======================================================");
                break;

            case CommandTypeEnum.ResponseOrderSaved:
                Console.WriteLine("Server Saved Order:");
                Console.WriteLine("Saved Order Id: {0}", orderItem.Id);
                Console.WriteLine("CurrencyCode Type: {0}", orderItem.CurrencyType);
                Console.WriteLine("Price: {0}", orderItem.Price);
                Console.WriteLine("Value: {0}", orderItem.Value);
                Console.WriteLine("======================================================");
                break;
            }
        }
Example #14
0
        static void Instance_MessageSubmitted(IClientCore a, OrderItem orderItem)
        {
            switch (orderItem.CommandType)
            {
            case CommandTypeEnum.RequestPrice:
                Console.WriteLine("Client Requested Price");
                Console.WriteLine("CurrencyCode Type: {0}", orderItem.CurrencyType);
                Console.WriteLine("======================================================");
                break;

            case CommandTypeEnum.RequestOrder:
                Console.WriteLine("Client Request Order:");
                Console.WriteLine("Command Type: {0}", orderItem.CommandType);
                Console.WriteLine("CurrencyCode Type: {0}", orderItem.CurrencyType);
                Console.WriteLine("Price: {0}", orderItem.Price);
                Console.WriteLine("Value: {0}", orderItem.Value);
                Console.WriteLine("======================================================");
                break;
            }
        }
Example #15
0
        void EventManager_OnClientConnect(IClientCore client)
        {
            IClientIPEndpoint ipEndpoint;

            if (client.TryGet(out ipEndpoint))
            {
                IPAddress end = ipEndpoint.EndPoint;

                foreach (string ban in bans)
                {
                    if (end.ToString().StartsWith(ban))
                    {
                        client.Disconnect("Banned - network \"" + ban + "\" is not allowed to connect to this server.");
                        m_log.Warn("[IPBAN] Disconnected '" + end + "' due to '" + ban + "' ban.");
                        return;
                    }
                }

                //m_log.InfoFormat("[IPBAN] User \"{0}\" not in any ban lists. Allowing connection.", end);
            }
        }
        //
        // These 2 are for local and foreign users going away respectively
        //

        private void ProcessInventoryForHypergriding(IClientAPI client)
        {
            if (client is IClientCore)
            {
                IClientCore      core = (IClientCore)client;
                IClientInventory inv;

                if (core.TryGet <IClientInventory>(out inv))
                {
                    InventoryFolderBase root = m_Scene.InventoryService.GetRootFolder(client.AgentId);
                    if (root != null)
                    {
                        m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: Changing root inventory for user {0}", client.Name);
                        InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID);

                        List <InventoryFolderBase> keep = new List <InventoryFolderBase>();

                        foreach (InventoryFolderBase f in content.Folders)
                        {
                            if (f.Name != "My Suitcase")
                            {
                                f.Name = f.Name + " (Unavailable)";
                                keep.Add(f);
                            }
                        }

                        // items directly under the root folder
                        foreach (InventoryItemBase it in content.Items)
                        {
                            it.Name = it.Name + " (Unavailable)";
                        }
                        ;

                        // Send the new names
                        inv.SendBulkUpdateInventory(keep.ToArray(), content.Items.ToArray());
                    }
                }
            }
        }
        private void ClientConnectHandler(IClientCore clientCore)
        {
            if (clientCore is IClientAPI)
            {
                IClientAPI client = (IClientAPI)clientCore;

                // Classifieds
                client.AddGenericPacketHandler("avatarclassifiedsrequest", AvatarClassifiedsRequestHandler);
                client.OnClassifiedInfoRequest += ClassifiedInfoRequestHandler;
                client.OnClassifiedInfoUpdate += ClassifiedInfoUpdateHandler;
                client.OnClassifiedDelete += ClassifiedDeleteHandler;

                // Picks
                client.AddGenericPacketHandler("avatarpicksrequest", HandleAvatarPicksRequest);
                client.AddGenericPacketHandler("pickinforequest", HandlePickInfoRequest);
                client.OnPickInfoUpdate += PickInfoUpdateHandler;
                client.OnPickDelete += PickDeleteHandler;

                // Notes
                client.AddGenericPacketHandler("avatarnotesrequest", HandleAvatarNotesRequest);
                client.OnAvatarNotesUpdate += AvatarNotesUpdateHandler;

                // Profiles
                client.OnRequestAvatarProperties += RequestAvatarPropertiesHandler;

                client.OnUpdateAvatarProperties += UpdateAvatarPropertiesHandler;
                client.OnAvatarInterestUpdate += AvatarInterestUpdateHandler;
                client.OnUserInfoRequest += UserInfoRequestHandler;
                client.OnUpdateUserInfo += UpdateUserInfoHandler;
            }
        }
Example #18
0
 static void Instance_ClientConnected(IClientCore a)
 {
     Console.WriteLine("Client {0} connected to server {1}:{2} at {3}",
                       a.Id, _ip, _port, a.StartTime.ToString("G"));
 }