本文整理汇总了C#中IClientAPI.SendChangeUserRights方法的典型用法代码示例。如果您正苦于以下问题:C# IClientAPI.SendChangeUserRights方法的具体用法?C# IClientAPI.SendChangeUserRights怎么用?C# IClientAPI.SendChangeUserRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IClientAPI
的用法示例。
在下文中一共展示了IClientAPI.SendChangeUserRights方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: client_OnGrantUserRights
void client_OnGrantUserRights(IClientAPI sender, OpenMetaverse.UUID grantor, OpenMetaverse.UUID grantee, int rights)
{
if (sender.AgentId != grantor)
{
return;
}
//set the user rights on the DB
using (ISimpleDB db = _connFactory.GetConnection())
{
Dictionary<string, object> parms = new Dictionary<string,object>();
parms.Add("rights", rights);
parms.Add("ownerID", grantor);
parms.Add("friendID", grantee);
db.QueryNoResults( "UPDATE userfriends " +
"SET friendPerms = ?rights " +
"WHERE ownerID = ?ownerID AND friendID = ?friendID;",
parms );
}
m_scene.CommsManager.UserService.UpdateUserFriendPerms(grantor, grantee, (uint)rights);
sender.SendChangeUserRights(grantor, grantee, rights);
}
示例2: OnGrantUserRights
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
{
if (!m_Friends.ContainsKey(remoteClient.AgentId))
return;
m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
// Let's find the friend in this user's friend list
UserFriendData fd = m_Friends[remoteClient.AgentId];
FriendInfo friend = null;
foreach (FriendInfo fi in fd.Friends)
if (fi.Friend == target.ToString())
friend = fi;
if (friend != null) // Found it
{
// Store it on the DB
FriendsService.StoreFriend(requester, target.ToString(), rights);
// Store it in the local cache
int myFlags = friend.MyFlags;
friend.MyFlags = rights;
// Always send this back to the original client
remoteClient.SendChangeUserRights(requester, target, rights);
//
// Notify the friend
//
// Try local
if (LocalGrantRights(requester, target, myFlags, rights))
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
}
}
}
示例3: SendFriendsOnlineIfNeeded
public override bool SendFriendsOnlineIfNeeded(IClientAPI client)
{
// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering SendFriendsOnlineIfNeeded for {0}", client.Name);
if (base.SendFriendsOnlineIfNeeded(client))
{
AgentCircuitData aCircuit = ((Scene)client.Scene).AuthenticateHandler.GetAgentCircuitData(client.AgentId);
if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
{
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, client.AgentId);
if (account == null) // foreign
{
FriendInfo[] friends = GetFriends(client.AgentId);
foreach (FriendInfo f in friends)
{
client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, f.TheirFlags);
}
}
}
}
// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting SendFriendsOnlineIfNeeded for {0}", client.Name);
return false;
}
示例4: OnGrantUserRights
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
{
FriendInfo[] friends = GetFriends(remoteClient.AgentId);
if (friends.Length == 0)
return;
MainConsole.Instance.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights,
target);
// Let's find the friend in this user's friend list
FriendInfo friend = null;
#if (!ISWIN)
foreach (FriendInfo fi in friends)
{
if (fi.Friend == target.ToString())
{
friend = fi;
}
}
#else
foreach (FriendInfo fi in friends.Where(fi => fi.Friend == target.ToString()))
{
friend = fi;
}
#endif
if (friend != null) // Found it
{
// Store it on the DB
FriendsService.StoreFriend(requester, target.ToString(), rights);
// Store it in the local cache
int myFlags = friend.MyFlags;
friend.MyFlags = rights;
// Always send this back to the original client
remoteClient.SendChangeUserRights(requester, target, rights);
//
// Notify the friend
//
// Try local
if (!LocalGrantRights(requester, target, myFlags, rights))
{
SyncMessagePosterService.Post(SyncMessageHelper.FriendGrantRights(
requester, target, myFlags, rights, m_Scenes[0].RegionInfo.RegionHandle),
m_Scenes[0].RegionInfo.RegionHandle);
}
}
}
示例5: GrantRights
public void GrantRights(IClientAPI remoteClient, UUID friendID, int rights)
{
UUID requester = remoteClient.AgentId;
m_log.DebugFormat(
"[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}",
requester, rights, friendID);
FriendInfo[] friends = GetFriendsFromCache(requester);
if (friends.Length == 0)
{
return;
}
// Let's find the friend in this user's friend list
FriendInfo friend = GetFriend(friends, friendID);
if (friend != null) // Found it
{
// Store it on the DB
if (!StoreRights(requester, friendID, rights))
{
remoteClient.SendAlertMessage("Unable to grant rights.");
return;
}
// Store it in the local cache
int myFlags = friend.MyFlags;
friend.MyFlags = rights;
// Always send this back to the original client
remoteClient.SendChangeUserRights(requester, friendID, rights);
//
// Notify the friend
//
// Try local
if (LocalGrantRights(requester, friendID, myFlags, rights))
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, friendID, myFlags, rights);
}
}
}
else
{
m_log.DebugFormat("[FRIENDS MODULE]: friend {0} not found for {1}", friendID, requester);
}
}
示例6: OnGrantUserRights
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
{
FriendInfo[] friends = GetFriends(remoteClient.AgentId);
if (friends.Length == 0)
return;
m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
// Let's find the friend in this user's friend list
FriendInfo friend = null;
foreach (FriendInfo fi in friends)
{
if (fi.Friend == target.ToString())
friend = fi;
}
if (friend != null) // Found it
{
// Store it on the DB
FriendsService.StoreFriend(requester, target.ToString(), rights);
// Store it in the local cache
int myFlags = friend.MyFlags;
friend.MyFlags = rights;
// Always send this back to the original client
remoteClient.SendChangeUserRights(requester, target, rights);
//
// Notify the friend
//
// Try local
if (!LocalGrantRights(requester, target, myFlags, rights))
{
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
}
}
}
}
}
示例7: OnGrantUserRights
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
{
FriendInfo[] friends = GetFriends(remoteClient.AgentId);
if (friends.Length == 0)
return;
m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
// Let's find the friend in this user's friend list
FriendInfo friend = null;
foreach (FriendInfo fi in friends)
{
if (fi.Friend == target.ToString())
friend = fi;
}
if (friend != null) // Found it
{
// Store it on the DB
FriendsService.StoreFriend(requester, target.ToString(), rights);
// Store it in the local cache
int myFlags = friend.MyFlags;
friend.MyFlags = rights;
// Always send this back to the original client
remoteClient.SendChangeUserRights(requester, target, rights);
//
// Notify the friend
//
// Try local
if (!LocalGrantRights(requester, target, myFlags, rights))
{
UserInfo friendSession = m_Scenes[0].RequestModuleInterface<IAgentInfoService>().GetUserInfo(target.ToString());
if (friendSession != null && friendSession.IsOnline)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID,
friendSession.CurrentRegionID);
AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendGrantRights(
requester, target, myFlags, rights, region.RegionHandle));
}
}
}
}