本文整理汇总了C#中WhiteCore.Framework.ClientInterfaces.GridInstantMessage类的典型用法代码示例。如果您正苦于以下问题:C# GridInstantMessage类的具体用法?C# GridInstantMessage怎么用?C# GridInstantMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GridInstantMessage类属于WhiteCore.Framework.ClientInterfaces命名空间,在下文中一共展示了GridInstantMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddOfflineMessage
public bool AddOfflineMessage(GridInstantMessage message)
{
object remoteValue = DoRemote(message);
if (remoteValue != null || m_doRemoteOnly)
return remoteValue == null ? false : (bool) remoteValue;
if (m_maxOfflineMessages <= 0 ||
GenericUtils.GetGenericCount(message.ToAgentID, "OfflineMessages", GD) < m_maxOfflineMessages)
{
GenericUtils.AddGeneric(message.ToAgentID, "OfflineMessages", UUID.Random().ToString(),
message.ToOSD(), GD);
return true;
}
return false;
}
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:15,代码来源:LocalOfflineMessagesConnector.cs
示例2: SendInstantMessages
public virtual void SendInstantMessages (GridInstantMessage im, List<UUID> AgentsToSendTo)
{
//Check for local users first
List<UUID> RemoveUsers = new List<UUID> ();
foreach (UUID t in AgentsToSendTo) {
IScenePresence user;
foreach (IScene scene in m_scenes) {
if (!RemoveUsers.Contains (t) &&
scene.TryGetScenePresence (t, out user)) {
// Local message
user.ControllingClient.SendInstantMessage (im);
RemoveUsers.Add (t);
}
}
}
//Clear the local users out
foreach (UUID agentID in RemoveUsers) {
AgentsToSendTo.Remove (agentID);
}
SendMultipleGridInstantMessageViaXMLRPC (im, AgentsToSendTo);
}
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:22,代码来源:MessageTransferModule.cs
示例3: OnInstantMessage
/// <summary>
/// If its a message we deal with, pull it from the client here
/// </summary>
/// <param name="client"></param>
/// <param name="im"></param>
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{
byte dialog = im.Dialog;
switch (dialog)
{
case (byte) InstantMessageDialog.SessionGroupStart:
m_imService.CreateGroupChat(client.AgentId, im);
break;
case (byte) InstantMessageDialog.SessionSend:
m_imService.SendChatToSession(client.AgentId, im);
break;
case (byte) InstantMessageDialog.SessionDrop:
m_imService.DropMemberFromSession(client.AgentId, im);
break;
}
}
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:21,代码来源:AuroraChatModule.cs
示例4: SendChatToSession
public void SendChatToSession(UUID agentID, GridInstantMessage im)
{
if (m_doRemoteOnly)
{
DoRemoteCallPost(true, "InstantMessageServerURI", agentID, im);
return;
}
Util.FireAndForget((o) =>
{
ChatSession session;
ChatSessions.TryGetValue(im.SessionID, out session);
if (session == null)
return;
if (agentID != UUID.Zero) //Not system
{
ChatSessionMember sender = FindMember(im.SessionID, agentID);
if (sender.MuteText)
return; //They have been admin muted, don't allow them to send anything
}
Dictionary<string, List<GridInstantMessage>> messagesToSend =
new Dictionary<string, List<GridInstantMessage>>();
foreach (ChatSessionMember member in session.Members)
{
if (member.HasBeenAdded)
{
im.ToAgentID = member.AvatarKey;
im.BinaryBucket = Utils.StringToBytes(session.Name);
im.RegionID = UUID.Zero;
im.ParentEstateID = 0;
im.Offline = 0;
GridInstantMessage message = new GridInstantMessage();
message.FromOSD(im.ToOSD());
//im.timestamp = 0;
string uri = FindRegionURI(member.AvatarKey);
if (uri != "") //Check if they are online
{
//Bulk send all of the instant messages to the same region, so that we don't send them one-by-one over and over
if (messagesToSend.ContainsKey(uri))
messagesToSend[uri].Add(message);
else
messagesToSend.Add(uri, new List<GridInstantMessage>() {message});
}
}
else if (!member.RequestedRemoval)
//If they're requested to leave, don't recontact them
{
UUID regionID = FindRegionID(member.AvatarKey);
if (regionID != UUID.Zero)
{
im.ToAgentID = member.AvatarKey;
m_eventQueueService.ChatterboxInvitation(
session.SessionID
, session.Name
, im.FromAgentID
, im.Message
, im.ToAgentID
, im.FromAgentName
, im.Dialog
, im.Timestamp
, im.Offline == 1
, (int) im.ParentEstateID
, im.Position
, 1
, im.SessionID
, false
, Utils.StringToBytes(session.Name)
, regionID
);
}
}
}
foreach (KeyValuePair<string, List<GridInstantMessage>> kvp in messagesToSend)
{
SendInstantMessages(kvp.Key, kvp.Value);
}
});
}
开发者ID:CaseyraeStarfinder,项目名称:WhiteCore-Dev,代码行数:80,代码来源:InstantMessagingService.cs
示例5: CreateGroupChat
public void CreateGroupChat(UUID AgentID, GridInstantMessage im)
{
if (m_doRemoteOnly)
{
DoRemoteCallPost(true, "InstantMessageServerURI", AgentID, im);
return;
}
UUID GroupID = im.SessionID;
GroupRecord groupInfo = m_groupData.GetGroupRecord(AgentID, GroupID, null);
if (groupInfo != null)
{
if (!GroupPermissionCheck(AgentID, GroupID, GroupPowers.JoinChat))
return; //They have to be able to join to create a group chat
//Create the session.
if (!SessionExists(GroupID))
{
CreateSession(new ChatSession
{
Members = new List<ChatSessionMember>(),
SessionID = GroupID,
Name = groupInfo.GroupName
});
AddMemberToGroup(new ChatSessionMember
{
AvatarKey = AgentID,
CanVoiceChat = false,
IsModerator =
GroupPermissionCheck(AgentID, GroupID, GroupPowers.ModerateChat),
MuteText = false,
MuteVoice = false,
HasBeenAdded = true
}, GroupID);
foreach (
GroupMembersData gmd in
m_groupData.GetGroupMembers(AgentID, GroupID)
.Where(gmd => gmd.AgentID != AgentID)
.Where(
gmd =>
(gmd.AgentPowers & (ulong) GroupPowers.JoinChat) ==
(ulong) GroupPowers.JoinChat))
{
AddMemberToGroup(new ChatSessionMember
{
AvatarKey = gmd.AgentID,
CanVoiceChat = false,
IsModerator =
GroupPermissionCheck(gmd.AgentID, GroupID, GroupPowers.ModerateChat),
MuteText = false,
MuteVoice = false,
HasBeenAdded = false
}, GroupID);
}
//Tell us that it was made successfully
m_eventQueueService.ChatterBoxSessionStartReply(groupInfo.GroupName, GroupID,
AgentID, FindRegionID(AgentID));
}
else
{
ChatSession thisSession = GetSession(GroupID);
//A session already exists
//Add us
AddMemberToGroup(new ChatSessionMember
{
AvatarKey = AgentID,
CanVoiceChat = false,
IsModerator =
GroupPermissionCheck(AgentID, GroupID, GroupPowers.ModerateChat),
MuteText = false,
MuteVoice = false,
HasBeenAdded = true
}, GroupID);
//Tell us that we entered successfully
m_eventQueueService.ChatterBoxSessionStartReply(groupInfo.GroupName, GroupID,
AgentID, FindRegionID(AgentID));
List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock> Us =
new List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock>();
List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock> NotUsAgents =
new List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock>();
foreach (ChatSessionMember sessionMember in thisSession.Members)
{
ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block =
new ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock
{
AgentID = sessionMember.AvatarKey,
CanVoiceChat = sessionMember.CanVoiceChat,
IsModerator = sessionMember.IsModerator,
MuteText = sessionMember.MuteText,
MuteVoice = sessionMember.MuteVoice,
Transition = "ENTER"
};
if (AgentID == sessionMember.AvatarKey)
Us.Add(block);
if (sessionMember.HasBeenAdded)
// Don't add not joined yet agents. They don't want to be here.
//.........这里部分代码省略.........
开发者ID:CaseyraeStarfinder,项目名称:WhiteCore-Dev,代码行数:101,代码来源:InstantMessagingService.cs
示例6: SendGridInstantMessageViaXMLRPCAsync
/// <summary>
/// Recursive SendGridInstantMessage over XMLRPC method.
/// This is called from within a dedicated thread.
/// The first time this is called, prevRegionHandle will be 0 Subsequent times this is called from
/// itself, prevRegionHandle will be the last region handle that we tried to send.
/// If the handles are the same, we look up the user's location using the grid.
/// If the handles are still the same, we end. The send failed.
/// </summary>
/// <param name="im"></param>
/// <param name="prevRegion">
/// Pass in 0 the first time this method is called. It will be called recursively with the last
/// regionhandle tried
/// </param>
protected virtual void SendGridInstantMessageViaXMLRPCAsync (GridInstantMessage im,
GridRegion prevRegion)
{
UUID toAgentID = im.ToAgentID;
string HTTPPath = "";
lock (IMUsersCache) {
if (!IMUsersCache.TryGetValue (toAgentID, out HTTPPath))
HTTPPath = "";
}
if (HTTPPath != "") {
//We've tried to send an IM to them before, pull out their info
//Send the IM to their last location
if (!doIMSending (HTTPPath, im)) {
//If this fails, the user has either moved from their stored location or logged out
//Since it failed, let it look them up again and rerun
lock (IMUsersCache) {
IMUsersCache.Remove (toAgentID);
}
//Clear the path and let it continue trying again.
HTTPPath = "";
} else {
//Send the IM, and it made it to the user, return true
return;
}
}
//Now query the grid server for the agent
List<string> AgentLocations = m_agentInfoService.GetAgentsLocations (im.FromAgentID.ToString (),
new List<string> (new [] { toAgentID.ToString () }));
if (AgentLocations != null && AgentLocations.Count > 0) {
//No agents, so this user is offline
if (AgentLocations [0] == "NotOnline") {
lock (IMUsersCache) {
//Remove them so we keep testing against the db
IMUsersCache.Remove (toAgentID);
}
MainConsole.Instance.Debug ("[GRID INSTANT MESSAGE]: Unable to deliver an instant message as user is not online");
HandleUndeliveredMessage (im, "User is not online.");
return;
}
if (AgentLocations [0] == "NonExistant") {
IMUsersCache.Remove (toAgentID);
MainConsole.Instance.Info ("[GRID INSTANT MESSAGE]: Unable to deliver an instant message to " +
toAgentID +
", user does not exist");
HandleUndeliveredMessage (im, "User does not exist.");
return;
}
HTTPPath = AgentLocations [0];
}
//We found the agent's location, now ask them about the user
if (HTTPPath != "") {
if (!doIMSending (HTTPPath, im)) {
//It failed, stop now
lock (IMUsersCache) {
//Remove them so we keep testing against the db
IMUsersCache.Remove (toAgentID);
}
MainConsole.Instance.Info (
"[GRID INSTANT MESSAGE]: Unable to deliver an instant message as the region could not be found");
HandleUndeliveredMessage (im, "Failed to send IM to destination.");
return;
} else {
//Add to the cache
if (!IMUsersCache.ContainsKey (toAgentID))
IMUsersCache.Add (toAgentID, HTTPPath);
//Send the IM, and it made it to the user, return true
return;
}
} else {
//Couldn't find them, stop for now
lock (IMUsersCache) {
//Remove them so we keep testing against the db
IMUsersCache.Remove (toAgentID);
}
MainConsole.Instance.Info (
"[GRID INSTANT MESSAGE]: Unable to deliver an instant message as the region could not be found");
HandleUndeliveredMessage (im, "Agent Location was blank.");
}
}
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:96,代码来源:MessageTransferModule.cs
示例7: SendGridInstantMessageViaXMLRPC
protected virtual void SendGridInstantMessageViaXMLRPC (GridInstantMessage im)
{
GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync;
d.BeginInvoke (im, null, GridInstantMessageCompleted, d);
}
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:6,代码来源:MessageTransferModule.cs
示例8: OnInstantMessage
public void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{
byte dialog = im.Dialog;
if (dialog != (byte) InstantMessageDialog.MessageFromAgent
&& dialog != (byte) InstantMessageDialog.StartTyping
&& dialog != (byte) InstantMessageDialog.StopTyping
&& dialog != (byte) InstantMessageDialog.BusyAutoResponse
&& dialog != (byte) InstantMessageDialog.MessageFromObject)
{
return;
}
if (m_TransferModule != null)
{
if (client == null)
{
UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.AllScopeIDs,
im.FromAgentID);
if (account != null)
im.FromAgentName = account.Name;
else
im.FromAgentName = im.FromAgentName + "(No account found for this user)";
}
else
im.FromAgentName = client.Name;
m_TransferModule.SendInstantMessage(im);
}
}
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:30,代码来源:InstantMessageModule.cs
示例9: OnGridInstantMessage
private void OnGridInstantMessage(GridInstantMessage msg)
{
if (m_debugEnabled)
MainConsole.Instance.InfoFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);
// Trigger the above event handler
OnInstantMessage(null, msg);
// If a message from a group arrives here, it may need to be forwarded to a local client
if (msg.FromGroup)
{
switch (msg.Dialog)
{
case (byte) InstantMessageDialog.GroupInvitation:
case (byte) InstantMessageDialog.GroupNotice:
UUID toAgentID = msg.ToAgentID;
IClientAPI localClient = GetActiveClient(toAgentID);
if (localClient != null)
{
localClient.SendInstantMessage(msg);
}
break;
}
}
}
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:25,代码来源:GroupsModule.cs
示例10: BuildOfflineGroupNotice
public GridInstantMessage BuildOfflineGroupNotice(GridInstantMessage msg)
{
msg.Dialog = 211; //We set this so that it isn't taken the wrong way later
return msg;
}
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:5,代码来源:GroupsModule.cs
示例11: EventManager_OnClientLogin
private void EventManager_OnClientLogin(IClientAPI client)
{
if (client.Scene.GetScenePresence(client.AgentId).IsChildAgent)
return;
List<GroupInviteInfo> inviteInfo = m_groupData.GetGroupInvites(client.AgentId);
if (inviteInfo.Count != 0)
{
foreach (GroupInviteInfo Invite in inviteInfo)
{
if (m_msgTransferModule != null)
{
UUID inviteUUID = Invite.InviteID;
GridInstantMessage msg = new GridInstantMessage
{
SessionID = inviteUUID,
FromAgentID = Invite.GroupID,
ToAgentID = Invite.AgentID,
Timestamp = (uint) Util.UnixTimeSinceEpoch(),
FromAgentName = Invite.FromAgentName,
RegionID = client.Scene.RegionInfo.RegionID
};
GroupRecord groupInfo = GetGroupRecord(Invite.GroupID);
string MemberShipCost = ". There is no cost to join this group.";
if (groupInfo.MembershipFee != 0)
MemberShipCost = ". To join, you must pay " + groupInfo.MembershipFee.ToString() + ".";
msg.Message =
string.Format("{0} has invited you to join " + groupInfo.GroupName + MemberShipCost,
Invite.FromAgentName);
msg.Dialog = (byte) InstantMessageDialog.GroupInvitation;
msg.FromGroup = true;
msg.Offline = 0;
msg.ParentEstateID = 0;
msg.Position = Vector3.Zero;
msg.RegionID = UUID.Zero;
msg.BinaryBucket = new byte[20];
OutgoingInstantMessage(msg, Invite.AgentID);
}
}
}
}
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:46,代码来源:GroupsModule.cs
示例12: BuildGroupNoticeIM
private GridInstantMessage BuildGroupNoticeIM(GroupNoticeInfo data, UUID groupNoticeID, UUID AgentID)
{
GridInstantMessage msg = new GridInstantMessage
{
FromAgentID = data.GroupID,
ToAgentID = AgentID,
Timestamp = data.noticeData.Timestamp,
FromAgentName = data.noticeData.FromName,
Message = data.noticeData.Subject + "|" + data.Message,
Dialog = (byte) InstantMessageDialog.GroupNoticeRequested,
FromGroup = true,
Offline = 1,
ParentEstateID = 0,
Position = Vector3.Zero,
RegionID = UUID.Zero,
SessionID = UUID.Random()
};
//Allow offline
if (data.noticeData.HasAttachment)
{
msg.BinaryBucket = CreateBitBucketForGroupAttachment(data.noticeData, data.GroupID);
//Save the sessionID for the callback by the client (reject or accept)
//Only save if has attachment
msg.SessionID = data.noticeData.ItemID;
}
else
{
byte[] bucket = new byte[19];
bucket[0] = 0; //Attachment enabled == false so 0
bucket[1] = 0; //No attachment, so no asset type
data.GroupID.ToBytes(bucket, 2);
bucket[18] = 0; //dunno
msg.BinaryBucket = bucket;
}
return msg;
}
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:38,代码来源:GroupsModule.cs
示例13: TriggerIncomingInstantMessage
public void TriggerIncomingInstantMessage(GridInstantMessage message)
{
IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;
if (handlerIncomingInstantMessage != null)
{
foreach (IncomingInstantMessage d in handlerIncomingInstantMessage.GetInvocationList())
{
try
{
d(message);
}
catch (Exception e)
{
MainConsole.Instance.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing. {0} {1}",
e, e.StackTrace);
}
}
}
}
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:20,代码来源:EventManager.cs
示例14: UndeliveredMessage
void UndeliveredMessage (GridInstantMessage im, string reason)
{
if (OfflineMessagesConnector == null || im == null)
return;
IClientAPI client = FindClient (im.FromAgentID);
if ((client == null) && (im.Dialog != 32))
return;
if (!OfflineMessagesConnector.AddOfflineMessage (im)) {
if ((!im.FromGroup) && (reason != "User does not exist.") && (client != null))
client.SendInstantMessage (new GridInstantMessage () {
FromAgentID = im.ToAgentID,
FromAgentName = "System",
ToAgentID = im.FromAgentID,
Dialog = (byte)InstantMessageDialog.MessageFromAgent,
Message = "User has too many IMs already, please try again later.",
Offline = 0,
RegionID = im.RegionID
});
else if (client == null)
return;
} else if ((im.Offline != 0) && (!im.FromGroup || im.FromGroup)) {
if (im.Dialog == 32) //Group notice
{
IGroupsModule module = m_Scene.RequestModuleInterface<IGroupsModule> ();
if (module != null)
im = module.BuildOfflineGroupNotice (im);
// TODO: This drops (supposedly) group messages and the logic above is interesting!!
return;
}
if (client == null) return;
IEmailModule emailModule = m_Scene.RequestModuleInterface<IEmailModule> ();
if (emailModule != null && m_SendOfflineMessagesToEmail) {
IUserProfileInfo profile =
Framework.Utilities.DataManager.RequestPlugin<IProfileConnector> ().GetUserProfile (im.ToAgentID);
if (profile != null && profile.IMViaEmail) {
UserAccount account = m_Scene.UserAccountService.GetUserAccount (null, im.ToAgentID);
if (account != null && !string.IsNullOrEmpty (account.Email)) {
emailModule.SendEmail (UUID.Zero, account.Email,
string.Format ("Offline Message from {0}", im.FromAgentName),
string.Format ("Time: {0}\n",
Util.ToDateTime (im.Timestamp).ToShortDateString ()) +
string.Format ("From: {0}\n", im.FromAgentName) +
string.Format ("Message: {0}\n", im.Message), m_Scene);
}
}
}
if (im.Dialog == (byte)InstantMessageDialog.MessageFromAgent && !im.FromGroup) {
client.SendInstantMessage (new GridInstantMessage () {
FromAgentID = im.ToAgentID,
FromAgentName = "System",
ToAgentID = im.FromAgentID,
Dialog = (byte)InstantMessageDialog.MessageFromAgent,
Message = "Message saved, reason: " + reason,
Offline = 0,
RegionID = im.RegionID
});
}
if (im.Dialog == (byte)InstantMessageDialog.InventoryOffered)
client.SendAlertMessage ("User is not online. Inventory has been saved");
} else if (im.Offline == 0) {
if (client == null) return;
if (im.Dialog == (byte)InstantMessageDialog.MessageFromAgent && !im.FromGroup) {
client.SendInstantMessage (new GridInstantMessage () {
FromAgentID = im.ToAgentID,
FromAgentName = "System",
ToAgentID = im.FromAgentID,
Dialog = (byte)InstantMessageDialog.MessageFromAgent,
Message = "Message saved, reason: " + reason,
Offline = 0,
RegionID = im.RegionID
});
}
if (im.Dialog == (byte)InstantMessageDialog.InventoryOffered)
client.SendAlertMessage ("User not able to be found. Inventory has been saved");
}
}
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:84,代码来源:OfflineMessagesModule.cs
示例15: SendInstantMessage
public void SendInstantMessage(GridInstantMessage im)
{
IMessageTransferModule m_TransferModule =
m_object.Scene.RequestModuleInterface<IMessageTransferModule>();
if (m_TransferModule != null)
m_TransferModule.SendInstantMessage(im);
}
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:7,代码来源:BotPrimController.cs
示例16: OnGridInstantMessage
void OnGridInstantMessage (GridInstantMessage im)
{
if (im.Dialog == (byte)InstantMessageDialog.RequestTeleport) {
MainConsole.Instance.DebugFormat (
"[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}",
im.SessionID, im.RegionID, im.Message);
// Forward. We do this, because the IM module explicitly rejects
// IMs of this type
if (m_TransferModule != null)
m_TransferModule.SendInstantMessage (im);
}
}
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:13,代码来源:LureModule.cs
示例17: OnGridInstantMessage
/// <summary>
/// </summary>
/// <param name="msg"></param>
void OnGridInstantMessage(GridInstantMessage msg)
{
byte dialog = msg.Dialog;
if (dialog != (byte) InstantMessageDialog.MessageFromAgent
&& dialog != (byte) InstantMessageDialog.StartTyping
&& dialog != (byte) InstantMessageDialog.StopTyping
&& dialog != (byte) InstantMessageDialog.MessageFromObject)
{
return;
}
if (m_TransferModule != null)
{
UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.AllScopeIDs,
msg.FromAgentID);
if (account != null)
msg.FromAgentName = account.Name;
else
msg.FromAgentName = msg.FromAgentName + "(No account found for this user)";
IScenePresence presence = null;
if (m_Scene.TryGetScenePresence(msg.ToAgentID, out presence))
{
presence.ControllingClient.SendInstantMessage(msg);
return;
}
}
}
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:32,代码来源:InstantMessageModule.cs
示例18: OnInstantMessage
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
{
if (m_debugEnabled)
MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);
// Group invitations
if ((im.Dialog == (byte) InstantMessageDialog.GroupInvitationAccept) ||
(im.Dialog == (byte) InstantMessageDialog.GroupInvitationDecline))
{
UUID inviteID = im.SessionID;
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentID(remoteClient),
inviteID);
if (inviteInfo == null)
{
if (m_debugEnabled)
MainConsole.Instance.WarnFormat(
"[GROUPS]: Received an Invite IM for an invite that does not exist {0}.",
inviteID);
return;
}
if (m_debugEnabled)
MainConsole.Instance.DebugFormat("[GROUPS]: Invite is for Agent {0} to Group {1}.",
inviteInfo.AgentID,
inviteInfo.GroupID);
UUID fromAgentID = im.FromAgentID;
if ((inviteInfo != null) && (fromAgentID == inviteInfo.AgentID))
{
// Accept
if (im.Dialog == (byte) InstantMessageDialog.GroupInvitationAccept)
{
if (m_debugEnabled)
MainConsole.Instance.DebugFormat("[GROUPS]: Received an accept invite notice.");
// and the sessionid is the role
UserAccount account = m_scene.UserAccountService.GetUserAccount(remoteClient.AllScopeIDs,
inviteInfo.FromAgentName);
if (account != null)
{
m_groupData.AddAgentToGroup(account.PrincipalID, inviteInfo.AgentID, inviteInfo.GroupID,
inviteInfo.RoleID);
GridInstantMessage msg = new GridInstantMessage
{
SessionID = UUID.Zero,
FromAgentID = UUID.Zero,
ToAgentID = inviteInfo.AgentID,
Timestamp = (uint) Util.UnixTimeSinceEpoch(),
FromAgentName = "Groups",
Message =
string.Format("You have been added to the group."),
Dialog = (byte) InstantMessageDialog.MessageBox,
FromGroup = false,
Offline = 0,
ParentEstateID = 0,
Position = Vector3.Zero,
RegionID = UUID.Zero,
BinaryBucket = new byte[0]
};
OutgoingInstantMessage(msg, inviteInfo.AgentID);
GroupMembershipData gmd =
AttemptFindGroupMembershipData(inviteInfo.AgentID, inviteInfo.AgentID,
inviteInfo.GroupID);
m_cachedGroupTitles[inviteInfo.AgentID] = gmd;
m_cachedGroupMemberships.Remove(remoteClient.AgentId);
RemoveFromGroupPowersCache(inviteInfo.AgentID, inviteInfo.GroupID);
UpdateAllClientsWithGroupInfo(inviteInfo.AgentID, gmd.GroupTitle);
SendAgentGroupDataUpdate(remoteClient);
m_groupData.RemoveAgentInvite(GetRequestingAgentID(remoteClient), inviteID);
}
}
// Reject
if (im.Dialog == (byte) InstantMessageDialog.GroupInvitationDecline)
{
if (m_debugEnabled)
MainConsole.Instance.DebugFormat("[GROUPS]: Received a reject invite notice.");
m_groupData.RemoveAgentInvite(GetRequestingAgentID(remoteClient), inviteID);
}
RemoveFromGroupPowersCache(remoteClient.AgentId, inviteInfo.GroupID);
}
}
// Group notices
switch (im.Dialog)
{
case (byte) InstantMessageDialog.GroupNot
|
请发表评论