HGFriendsModule: Added optional user level based restriction to send friendship invitations to foreign users.
parent
f2ede8c7e0
commit
1f4d3d3582
|
@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private int m_levelHGFriends = 0;
|
||||||
|
|
||||||
IUserManagement m_uMan;
|
IUserManagement m_uMan;
|
||||||
public IUserManagement UserManagementModule
|
public IUserManagement UserManagementModule
|
||||||
{
|
{
|
||||||
|
@ -95,6 +97,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
IConfig friendsConfig = config.Configs["HGFriendsModule"];
|
IConfig friendsConfig = config.Configs["HGFriendsModule"];
|
||||||
if (friendsConfig != null)
|
if (friendsConfig != null)
|
||||||
{
|
{
|
||||||
|
m_levelHGFriends = friendsConfig.GetInt("LevelHGFriends", 0);
|
||||||
|
|
||||||
// TODO: read in all config variables pertaining to
|
// TODO: read in all config variables pertaining to
|
||||||
// HG friendship permissions
|
// HG friendship permissions
|
||||||
}
|
}
|
||||||
|
@ -126,10 +130,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
UUID principalID = new UUID(im.fromAgentID);
|
UUID principalID = new UUID(im.fromAgentID);
|
||||||
UUID friendID = new UUID(im.toAgentID);
|
UUID friendID = new UUID(im.toAgentID);
|
||||||
|
|
||||||
// TODO: CHECK IF friendID is foreigner and if principalID has the permission
|
// Check if friendID is foreigner and if principalID has the permission
|
||||||
// to request these kinds of friendships. If not, return immediately.
|
// to request friendships with foreigners. If not, return immediately.
|
||||||
// Maybe you want to let the client know too with
|
if (!UserManagementModule.IsLocalGridUser(friendID))
|
||||||
// client.SendAlertMessage
|
{
|
||||||
|
ScenePresence avatar = null;
|
||||||
|
client.Scene.TryGetScenePresence(principalID, out avatar);
|
||||||
|
|
||||||
|
if (avatar == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (avatar.UserLevel < m_levelHGFriends)
|
||||||
|
{
|
||||||
|
client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnInstantMessage(client, im);
|
base.OnInstantMessage(client, im);
|
||||||
|
|
|
@ -137,6 +137,10 @@
|
||||||
;; uncomment the next line. You may want to do this on sims that have licensed content.
|
;; uncomment the next line. You may want to do this on sims that have licensed content.
|
||||||
; OutboundPermission = False
|
; OutboundPermission = False
|
||||||
|
|
||||||
|
[HGFriendsModule]
|
||||||
|
; User level required to be able to send friendship invitations to foreign users
|
||||||
|
;LevelHGFriends = 0;
|
||||||
|
|
||||||
[UserAgentService]
|
[UserAgentService]
|
||||||
;
|
;
|
||||||
; === HG ONLY ===
|
; === HG ONLY ===
|
||||||
|
|
|
@ -61,6 +61,10 @@
|
||||||
;; uncomment the next line. You may want to do this on sims that have licensed content.
|
;; uncomment the next line. You may want to do this on sims that have licensed content.
|
||||||
; OutboundPermission = False
|
; OutboundPermission = False
|
||||||
|
|
||||||
|
[HGFriendsModule]
|
||||||
|
; User level required to be able to send friendship invitations to foreign users
|
||||||
|
;LevelHGFriends = 0;
|
||||||
|
|
||||||
[GridService]
|
[GridService]
|
||||||
;; For in-memory region storage (default)
|
;; For in-memory region storage (default)
|
||||||
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
|
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
|
||||||
|
|
Loading…
Reference in New Issue