Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008810opensim[REGION] Script Functionspublic2020-11-15 14:132020-11-18 21:43
ReporterGezebu MindBlue 
Assigned To 
PrioritylowSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformlinuxOSfedoraOS Version32
Product Version 
Target VersionFixed in Version 
Summary0008810: osGetAgentCountry ...
DescriptionThe documentation says that "The country information must be added to grid database using external user admin tools", but in the database not exist the necessary field to added this information in the UserAccounts table, and userdata does not have any field. The wiki also does not provide information about which table and name the field for that information should be created. The command create user also does not give the possibility to enter the data. It could be convenient the existence of the command modify user, to be able to modify something more than the password or the email.

In the case of an existing user, osGetAgentCountry will not return any value, whitout errors.
But in the case of an Npc, an exception occurs that disables the script:

18:25:36 - [YEngine]: Exception while running 7a1ee1ee-227f-4e51-ba7a-177164479b28
NullReferenceException: Object reference not set to an instance of an object
Prim: <GeZ_Sensor_HUD_1.2>, Script: <GeZ_Sensor_HUD_1.2_2020>, Location: GeZ Sandbox <129,123,22>
Script must be Reset to re-enable.
  at OpenSim.Region.ScriptEngine.Shared.Api.OSSL_Api.osGetAgentCountry (OpenSim.Region.ScriptEngine.Shared.LSL_Types+LSLString id) [0x000ef] in <4690fe399e5d43b0b1cd4c167b2b609b>:0
  at OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass.osGetAgentCountry (OpenSim.Region.ScriptEngine.Shared.LSL_Types+LSLString agentId) [0x00001] in <d73150d16678418babf4a68895cdf550>:0
  at (wrapper dynamic-method) System.Object.avatar_info(key)(XMRInstanceSuperType,string)
  at (wrapper dynamic-method) System.Object.default listen(OpenSim.Region.ScriptEngine.Yengine.XMRInstAbstract)
  at OpenSim.Region.ScriptEngine.Yengine.XMRInstAbstract.CallSEH () [0x00050] in <c9cff9724af24220b5e04d8ee9bad7de>:0
  at OpenSim.Region.ScriptEngine.Yengine.XMRInstance.StartEx () [0x00009] in <c9cff9724af24220b5e04d8ee9bad7de>:0System.NullReferenceException: Object reference not set to an instance of an object
  at OpenSim.Region.ScriptEngine.Shared.Api.OSSL_Api.osGetAgentCountry (OpenSim.Region.ScriptEngine.Shared.LSL_Types+LSLString id) [0x000ef] in <4690fe399e5d43b0b1cd4c167b2b609b>:0
  at OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass.osGetAgentCountry (OpenSim.Region.ScriptEngine.Shared.LSL_Types+LSLString agentId) [0x00001] in <d73150d16678418babf4a68895cdf550>:0
  at (wrapper dynamic-method) System.Object.avatar_info(key)(XMRInstanceSuperType,string)
  at (wrapper dynamic-method) System.Object.default listen(OpenSim.Region.ScriptEngine.Yengine.XMRInstAbstract)
  at OpenSim.Region.ScriptEngine.Yengine.XMRInstAbstract.CallSEH () [0x00050] in <c9cff9724af24220b5e04d8ee9bad7de>:0
  at OpenSim.Region.ScriptEngine.Yengine.XMRInstance.StartEx () [0x00009] in <c9cff9724af24220b5e04d8ee9bad7de>:0
  
Steps To Reproducekey npc_uuid = "8c5a010c-4126-4bfa-babe-5c1d44c9026d";
default
{
    state_entry()
    {
        llOwnerSay(llKey2Name(npc_uuid)+" country: "+osGetAgentCountry(npc_uuid));
    }
}
TagsNo tags attached.
Git Revision or version numberVersion: OpenSim 0.9.2.0 Yeti Dev 08b06ec (SIMULATION/0.3 - SIMULATION/0.8)
Run Mode Grid (Multiple Regions per Sim)
Physics EngineBulletSim
Script EngineYEngine
EnvironmentMono / Linux64
Mono Version6.x
ViewerFirestorm 6.3.9.58205
Attached Filespatch file icon NPC-does-not-have-a-country.patch [^] (1,280 bytes) 2020-11-15 15:27 [Show Content]
png file icon user_country.png [^] (25,389 bytes) 2020-11-15 20:18

- Relationships
child of 0008656new osDetectedCountry and osGetAgentCountry return empty response 

-  Notes
(0037150)
tampa (reporter)
2020-11-15 15:26

The key it is looking for is called "UserCountry" which should be equal to the field name, now I suspect that is a varchar255, don't think it matters where it is placed in the database. Don't see this being handled anywhere on input so I think you can only do that directly through the database at the moment.

In regards to the npc thing, yeah it seems the ossl implementation never checks if the scenepresence is an npc, easy fix though. I'll attach a patch you can try.
(0037152)
Gezebu MindBlue (reporter)
2020-11-15 16:02

right. add the field UserCountry in UserAccounts make osGetAgentCountry work...
(0037153)
djphil (reporter)
2020-11-15 18:46
edited on: 2020-11-15 19:17

Can you clarify exactly what we need to do for this function to work properly.
I had reported this issue in the past but it was never really resolved (mantis 0008656).
So I would be happy to see it finally work properly as well as osDetectedCountry.

(0037159)
djphil (reporter)
2020-11-15 19:56

I imagine this could be added to the Tampa patch to also cover the NPCs for the osDetectedCountry function.

- if (detectedParams == null)
+ if (detectedParams == null || detectedParams.IsNPC)
(0037161)
Gezebu MindBlue (reporter)
2020-11-15 20:17

@djphil as said tampa, you need add the UserCountry column in the UserAccounts table... but this user information can only be added manually. i used phpmyadmin.
(0037162)
djphil (reporter)
2020-11-15 20:23

Yes I did that as I explained in detail here 0008656
Nevertheless it remains very imprecise.
Is this going to be automated or will we always have to do it manually?
How should the field be filled in, a form, a service?
Little information on this subject, only drop-by-drop informations.
(0037163)
djphil (reporter)
2020-11-15 20:40
edited on: 2020-11-15 20:41

If we want to make this feature work, it is normal I find that we get the correct information to make it work correctly and thus avoid possible problems.

An example when creating the "UserCountry" field, we could leave it empty by default or assign it a default value like "Unknow".
Is it better to do this or not ...?

Tampa talks about a varchar 255 but I don't know of any country with such a long name.
Would varchar 32 or 64 not be more than enough?

Another question, will this be automatic or will we always have to add this field manually?

The information on the wiki does not speak of creating a "UserCountry" field manually in the "UserAccount" database. To date, the wiki speaks only of an "external user admin tools" without giving more details. It is very imprecise.

(0037169)
tampa (reporter)
2020-11-16 08:56

One thing to automate this would be to crawl the robust.log regularly for the logins and test them against IP geolocation and insert into the field then. That's not all that difficult to accomplish, but it relies on databases and external information. OpenSim does not implement anything relying on a service that could go away at any point(apart from vivox lol) so this is unlikely to happen.

I suspect one could also use AgentPrefs as reference to determine if someone is really from Spain when their viewer language is french, but that's all external and a lot easier to accomplish with php or bash.
(0037200)
djphil (reporter)
2020-11-18 21:27
edited on: 2020-11-18 21:48

There are free databases of ip countries (city, long, lat, etc ...) in different formats such as json, csv, sql, db, dll, etc ...
It can be downloaded from the internet and free of charge.
Opensim could download this and include it.

In this case Opensim would not depend on any external service.

(0037201)
djphil (reporter)
2020-11-18 21:43
edited on: 2020-11-18 22:14

A similar example is GeoIP from php

You only download the "GeoLite2-City.mmdb" file and the "geoip2.phar" file once and add them to your php folder
You also add the extension "php_geoip.dll" in php/ext and activate it in php.ini (for windows users).
Then you can use all the geoip functions provided by php (see https://www.php.net/manual/fr/book.geoip.php [^]) and you don't depend on any external service and you don't have to download anything ...


- Issue History
Date Modified Username Field Change
2020-11-15 14:13 Gezebu MindBlue New Issue
2020-11-15 15:24 Gezebu MindBlue Description Updated View Revisions
2020-11-15 15:26 tampa Note Added: 0037150
2020-11-15 15:27 tampa File Added: NPC-does-not-have-a-country.patch
2020-11-15 16:02 Gezebu MindBlue Note Added: 0037152
2020-11-15 18:39 djphil Relationship added child of 0008656
2020-11-15 18:46 djphil Note Added: 0037153
2020-11-15 18:52 djphil Note Edited: 0037153 View Revisions
2020-11-15 18:52 djphil Note Edited: 0037153 View Revisions
2020-11-15 18:53 djphil Note Edited: 0037153 View Revisions
2020-11-15 19:17 djphil Note Edited: 0037153 View Revisions
2020-11-15 19:56 djphil Note Added: 0037159
2020-11-15 20:17 Gezebu MindBlue Note Added: 0037161
2020-11-15 20:18 Gezebu MindBlue File Added: user_country.png
2020-11-15 20:23 djphil Note Added: 0037162
2020-11-15 20:40 djphil Note Added: 0037163
2020-11-15 20:41 djphil Note Edited: 0037163 View Revisions
2020-11-16 08:56 tampa Note Added: 0037169
2020-11-18 21:27 djphil Note Added: 0037200
2020-11-18 21:43 djphil Note Added: 0037201
2020-11-18 21:44 djphil Note Edited: 0037201 View Revisions
2020-11-18 21:48 djphil Note Edited: 0037200 View Revisions
2020-11-18 21:54 djphil Note Edited: 0037201 View Revisions
2020-11-18 22:14 djphil Note Edited: 0037201 View Revisions


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker