HGFriendsModule: add the scaffolding for supporting permissions pertaining to HG friendships. Snoopy take it from here.

integration
Diva Canto 2012-04-11 08:11:05 -07:00
parent 78fd487a70
commit f2ede8c7e0
2 changed files with 32 additions and 2 deletions

View File

@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
} }
} }
protected void InitModule(IConfigSource config) protected virtual void InitModule(IConfigSource config)
{ {
IConfig friendsConfig = config.Configs["Friends"]; IConfig friendsConfig = config.Configs["Friends"];
if (friendsConfig != null) if (friendsConfig != null)
@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
} }
} }
private void OnInstantMessage(IClientAPI client, GridInstantMessage im) protected virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{ {
if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
{ {

View File

@ -87,6 +87,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
m_StatusNotifier = new HGStatusNotifier(this); m_StatusNotifier = new HGStatusNotifier(this);
} }
protected override void InitModule(IConfigSource config)
{
base.InitModule(config);
// Additionally to the base method
IConfig friendsConfig = config.Configs["HGFriendsModule"];
if (friendsConfig != null)
{
// TODO: read in all config variables pertaining to
// HG friendship permissions
}
}
#endregion #endregion
#region IFriendsSimConnector #region IFriendsSimConnector
@ -105,6 +118,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
#endregion #endregion
protected override void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{
if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
{
// we got a friendship offer
UUID principalID = new UUID(im.fromAgentID);
UUID friendID = new UUID(im.toAgentID);
// TODO: CHECK IF friendID is foreigner and if principalID has the permission
// to request these kinds of friendships. If not, return immediately.
// Maybe you want to let the client know too with
// client.SendAlertMessage
}
base.OnInstantMessage(client, im);
}
protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders) protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders)
{ {
// Update the local cache. Yes, we need to do it right here // Update the local cache. Yes, we need to do it right here