aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs24
1 files changed, 20 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index ddb6a71..f8fbbbb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 private int m_levelHGFriends = 0;
54
53 IUserManagement m_uMan; 55 IUserManagement m_uMan;
54 public IUserManagement UserManagementModule 56 public IUserManagement UserManagementModule
55 { 57 {
@@ -95,6 +97,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
95 IConfig friendsConfig = config.Configs["HGFriendsModule"]; 97 IConfig friendsConfig = config.Configs["HGFriendsModule"];
96 if (friendsConfig != null) 98 if (friendsConfig != null)
97 { 99 {
100 m_levelHGFriends = friendsConfig.GetInt("LevelHGFriends", 0);
101
98 // TODO: read in all config variables pertaining to 102 // TODO: read in all config variables pertaining to
99 // HG friendship permissions 103 // HG friendship permissions
100 } 104 }
@@ -126,10 +130,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
126 UUID principalID = new UUID(im.fromAgentID); 130 UUID principalID = new UUID(im.fromAgentID);
127 UUID friendID = new UUID(im.toAgentID); 131 UUID friendID = new UUID(im.toAgentID);
128 132
129 // TODO: CHECK IF friendID is foreigner and if principalID has the permission 133 // Check if friendID is foreigner and if principalID has the permission
130 // to request these kinds of friendships. If not, return immediately. 134 // to request friendships with foreigners. If not, return immediately.
131 // Maybe you want to let the client know too with 135 if (!UserManagementModule.IsLocalGridUser(friendID))
132 // client.SendAlertMessage 136 {
137 ScenePresence avatar = null;
138 client.Scene.TryGetScenePresence(principalID, out avatar);
139
140 if (avatar == null)
141 return;
142
143 if (avatar.UserLevel < m_levelHGFriends)
144 {
145 client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false);
146 return;
147 }
148 }
133 } 149 }
134 150
135 base.OnInstantMessage(client, im); 151 base.OnInstantMessage(client, im);