本文整理汇总了C#中ImprovedInstantMessagePacket类的典型用法代码示例。如果您正苦于以下问题:C# ImprovedInstantMessagePacket类的具体用法?C# ImprovedInstantMessagePacket怎么用?C# ImprovedInstantMessagePacket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImprovedInstantMessagePacket类属于命名空间,在下文中一共展示了ImprovedInstantMessagePacket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Self_IM
void Self_IM(object sender, InstantMessageEventArgs e)
{
// TODO: MainAvatar.InstantMessageDialog.GroupNotice can also be an inventory offer, should we
// handle it here?
if (m_InventoryObjectOffered != null &&
(e.IM.Dialog == InstantMessageDialog.InventoryOffered
|| e.IM.Dialog == InstantMessageDialog.TaskInventoryOffered))
{
AssetType type = AssetType.Unknown;
UUID objectID = UUID.Zero;
bool fromTask = false;
if (e.IM.Dialog == InstantMessageDialog.InventoryOffered)
{
if (e.IM.BinaryBucket.Length == 17)
{
type = (AssetType)e.IM.BinaryBucket[0];
objectID = new UUID(e.IM.BinaryBucket, 1);
fromTask = false;
}
else
{
Logger.Log("Malformed inventory offer from agent", Helpers.LogLevel.Warning, Client);
return;
}
}
else if (e.IM.Dialog == InstantMessageDialog.TaskInventoryOffered)
{
if (e.IM.BinaryBucket.Length == 1)
{
type = (AssetType)e.IM.BinaryBucket[0];
fromTask = true;
}
else
{
Logger.Log("Malformed inventory offer from object", Helpers.LogLevel.Warning, Client);
return;
}
}
// Find the folder where this is going to go
UUID destinationFolderID = FindFolderForType(type);
// Fire the callback
try
{
ImprovedInstantMessagePacket imp = new ImprovedInstantMessagePacket();
imp.AgentData.AgentID = Client.Self.AgentID;
imp.AgentData.SessionID = Client.Self.SessionID;
imp.MessageBlock.FromGroup = false;
imp.MessageBlock.ToAgentID = e.IM.FromAgentID;
imp.MessageBlock.Offline = 0;
imp.MessageBlock.ID = e.IM.IMSessionID;
imp.MessageBlock.Timestamp = 0;
imp.MessageBlock.FromAgentName = Utils.StringToBytes(Client.Self.Name);
imp.MessageBlock.Message = Utils.EmptyBytes;
imp.MessageBlock.ParentEstateID = 0;
imp.MessageBlock.RegionID = UUID.Zero;
imp.MessageBlock.Position = Client.Self.SimPosition;
InventoryObjectOfferedEventArgs args = new InventoryObjectOfferedEventArgs(e.IM, type, objectID, fromTask, destinationFolderID);
OnInventoryObjectOffered(args);
if (args.Accept)
{
// Accept the inventory offer
switch (e.IM.Dialog)
{
case InstantMessageDialog.InventoryOffered:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.InventoryAccepted;
break;
case InstantMessageDialog.TaskInventoryOffered:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.TaskInventoryAccepted;
break;
case InstantMessageDialog.GroupNotice:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.GroupNoticeInventoryAccepted;
break;
}
imp.MessageBlock.BinaryBucket = args.FolderID.GetBytes();
}
else
{
// Decline the inventory offer
switch (e.IM.Dialog)
{
case InstantMessageDialog.InventoryOffered:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.InventoryDeclined;
break;
case InstantMessageDialog.TaskInventoryOffered:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.TaskInventoryDeclined;
break;
case InstantMessageDialog.GroupNotice:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.GroupNoticeInventoryDeclined;
break;
}
imp.MessageBlock.BinaryBucket = Utils.EmptyBytes;
}
//.........这里部分代码省略.........
示例2: SendInstantMessage
public bool SendInstantMessage(UUID messageID, UUID toAgentID, string fromName, Vector3 fromPosition,
UUID fromRegionID, bool fromGroup, InstantMessageDialog type, string message, bool allowOffline,
DateTime timestamp, byte[] binaryBucket)
{
// Cap the message length at 1023 + null terminator
if (!String.IsNullOrEmpty(message) && message.Length > 1023)
message = message.Substring(0, 1023);
// FIXME: Support IMing to remote agents
IScenePresence presence;
if (m_scene.TryGetPresence(toAgentID, out presence) && presence is LLAgent)
{
LLAgent agent = (LLAgent)presence;
ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();
im.AgentData.AgentID = agent.ID;
im.MessageBlock.Dialog = (byte)type;
im.MessageBlock.FromAgentName = Utils.StringToBytes(fromName);
im.MessageBlock.FromGroup = fromGroup;
im.MessageBlock.ID = messageID;
im.MessageBlock.Message = Utils.StringToBytes(message);
im.MessageBlock.Offline = (byte)((allowOffline) ? 1 : 0);
im.MessageBlock.ParentEstateID = 0;
im.MessageBlock.Position = fromPosition;
im.MessageBlock.RegionID = fromRegionID;
im.MessageBlock.Timestamp = Utils.DateTimeToUnixTime(timestamp);
im.MessageBlock.ToAgentID = agent.ID;
im.MessageBlock.BinaryBucket = binaryBucket ?? Utils.EmptyBytes;
m_udp.SendPacket(agent, im, ThrottleCategory.Task, false);
return true;
}
else
{
m_log.Warn("Dropping instant message from " + fromName + " to " + toAgentID + " that does not exist in the local scene");
return false;
}
}
示例3: InstantMessageGroup
/// <summary>
/// Send an Instant Message to a group the agent is a member of
/// </summary>
/// <param name="fromName">The name this IM will show up as being from</param>
/// <param name="groupID"><seealso cref="UUID"/> of the group to send message to</param>
/// <param name="message">Text message being sent</param>
public void InstantMessageGroup(string fromName, UUID groupID, string message)
{
lock (GroupChatSessions.Dictionary)
if (GroupChatSessions.ContainsKey(groupID))
{
ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();
im.AgentData.AgentID = Client.Self.AgentID;
im.AgentData.SessionID = Client.Self.SessionID;
im.MessageBlock.Dialog = (byte)InstantMessageDialog.SessionSend;
im.MessageBlock.FromAgentName = Utils.StringToBytes(fromName);
im.MessageBlock.FromGroup = false;
im.MessageBlock.Message = Utils.StringToBytes(message);
im.MessageBlock.Offline = 0;
im.MessageBlock.ID = groupID;
im.MessageBlock.ToAgentID = groupID;
im.MessageBlock.Position = Vector3.Zero;
im.MessageBlock.RegionID = UUID.Zero;
im.MessageBlock.BinaryBucket = Utils.StringToBytes("\0");
Client.Network.SendPacket(im);
}
else
{
Logger.Log("No Active group chat session appears to exist, use RequestJoinGroupChat() to join one",
Helpers.LogLevel.Error, Client);
}
}
示例4: InstantMessage
/// <summary>
/// Send an Instant Message
/// </summary>
/// <param name="fromName">The name this IM will show up as being from</param>
/// <param name="target">Key of Avatar</param>
/// <param name="message">Text message being sent</param>
/// <param name="imSessionID">IM session ID (to differentiate between IM windows)</param>
/// <param name="dialog">Type of instant message to send</param>
/// <param name="offline">Whether to IM offline avatars as well</param>
/// <param name="position">Senders Position</param>
/// <param name="regionID">RegionID Sender is In</param>
/// <param name="binaryBucket">Packed binary data that is specific to
/// the dialog type</param>
public void InstantMessage(string fromName, UUID target, string message, UUID imSessionID,
InstantMessageDialog dialog, InstantMessageOnline offline, Vector3 position, UUID regionID,
byte[] binaryBucket)
{
if (target != UUID.Zero)
{
ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();
if (imSessionID.Equals(UUID.Zero) || imSessionID.Equals(AgentID))
imSessionID = AgentID.Equals(target) ? AgentID : target ^ AgentID;
im.AgentData.AgentID = Client.Self.AgentID;
im.AgentData.SessionID = Client.Self.SessionID;
im.MessageBlock.Dialog = (byte)dialog;
im.MessageBlock.FromAgentName = Utils.StringToBytes(fromName);
im.MessageBlock.FromGroup = false;
im.MessageBlock.ID = imSessionID;
im.MessageBlock.Message = Utils.StringToBytes(message);
im.MessageBlock.Offline = (byte)offline;
im.MessageBlock.ToAgentID = target;
if (binaryBucket != null)
im.MessageBlock.BinaryBucket = binaryBucket;
else
im.MessageBlock.BinaryBucket = Utils.EmptyBytes;
// These fields are mandatory, even if we don't have valid values for them
im.MessageBlock.Position = Vector3.Zero;
//TODO: Allow region id to be correctly set by caller or fetched from Client.*
im.MessageBlock.RegionID = regionID;
// Send the message
Client.Network.SendPacket(im);
}
else
{
Logger.Log(String.Format("Suppressing instant message \"{0}\" to UUID.Zero", message),
Helpers.LogLevel.Error, Client);
}
}
示例5: Self_OnInstantMessage
private void Self_OnInstantMessage(InstantMessage im, Simulator simulator)
{
// TODO: MainAvatar.InstantMessageDialog.GroupNotice can also be an inventory offer, should we
// handle it here?
if (OnObjectOffered != null &&
(im.Dialog == InstantMessageDialog.InventoryOffered || im.Dialog == InstantMessageDialog.TaskInventoryOffered))
{
AssetType type = AssetType.Unknown;
LLUUID objectID = LLUUID.Zero;
bool fromTask = false;
if (im.Dialog == InstantMessageDialog.InventoryOffered)
{
if (im.BinaryBucket.Length == 17)
{
type = (AssetType)im.BinaryBucket[0];
objectID = new LLUUID(im.BinaryBucket, 1);
fromTask = false;
}
else
{
_Client.Log("Malformed inventory offer from agent", Helpers.LogLevel.Warning);
return;
}
}
else if (im.Dialog == InstantMessageDialog.TaskInventoryOffered)
{
if (im.BinaryBucket.Length == 1)
{
type = (AssetType)im.BinaryBucket[0];
fromTask = true;
}
else
{
_Client.Log("Malformed inventory offer from object", Helpers.LogLevel.Warning);
return;
}
}
// Find the folder where this is going to go
LLUUID destinationFolderID = FindFolderForType(type);
// Fire the callback
try
{
ImprovedInstantMessagePacket imp = new ImprovedInstantMessagePacket();
imp.AgentData.AgentID = _Client.Self.AgentID;
imp.AgentData.SessionID = _Client.Self.SessionID;
imp.MessageBlock.FromGroup = false;
imp.MessageBlock.ToAgentID = im.FromAgentID;
imp.MessageBlock.Offline = 0;
imp.MessageBlock.ID = im.IMSessionID;
imp.MessageBlock.Timestamp = 0;
imp.MessageBlock.FromAgentName = Helpers.StringToField(_Client.Self.Name);
imp.MessageBlock.Message = new byte[0];
imp.MessageBlock.ParentEstateID = 0;
imp.MessageBlock.RegionID = LLUUID.Zero;
imp.MessageBlock.Position = _Client.Self.SimPosition;
if (OnObjectOffered(im.FromAgentID, im.FromAgentName, im.ParentEstateID, im.RegionID, im.Position,
im.Timestamp, type, objectID, fromTask))
{
// Accept the inventory offer
switch (im.Dialog)
{
case InstantMessageDialog.InventoryOffered:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.InventoryAccepted;
break;
case InstantMessageDialog.TaskInventoryOffered:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.TaskInventoryAccepted;
break;
case InstantMessageDialog.GroupNotice:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.GroupNoticeInventoryAccepted;
break;
}
imp.MessageBlock.BinaryBucket = destinationFolderID.GetBytes();
}
else
{
// Decline the inventory offer
switch (im.Dialog)
{
case InstantMessageDialog.InventoryOffered:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.InventoryDeclined;
break;
case InstantMessageDialog.TaskInventoryOffered:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.TaskInventoryDeclined;
break;
case InstantMessageDialog.GroupNotice:
imp.MessageBlock.Dialog = (byte)InstantMessageDialog.GroupNoticeInventoryDeclined;
break;
}
imp.MessageBlock.BinaryBucket = new byte[0];
}
_Client.Network.SendPacket(imp, simulator);
}
//.........这里部分代码省略.........
示例6: RequestLeaveGroupChat
/// <summary>
/// Request self terminates group chat. This will stop Group IM's from showing up
/// until session is rejoined or expires.
/// </summary>
/// <param name="groupUUID"><seealso cref="T:libsecondlife.LLUUID"/> of Group to leave</param>
public void RequestLeaveGroupChat(LLUUID groupUUID)
{
ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();
im.AgentData.AgentID = Client.Self.AgentID;
im.AgentData.SessionID = Client.Self.SessionID;
im.MessageBlock.Dialog = (byte)InstantMessageDialog.SessionDrop;
im.MessageBlock.FromAgentName = Helpers.StringToField(Client.Self.Name);
im.MessageBlock.FromGroup = false;
im.MessageBlock.Message = new byte[0];
im.MessageBlock.Offline = 0;
im.MessageBlock.ID = groupUUID;
im.MessageBlock.ToAgentID = groupUUID;
im.MessageBlock.BinaryBucket = new byte[0];
im.MessageBlock.Position = LLVector3.Zero;
im.MessageBlock.RegionID = LLUUID.Zero;
Client.Network.SendPacket(im);
}
示例7: GiveItemViaImprovedInstantMessage
public Packet GiveItemViaImprovedInstantMessage(
LLUUID ID
, LLUUID ToAgentID
, String FromAgentName
, LLVector3 FromAgentLoc
, InventoryItem Item
)
{
byte[] BinaryBucket = new byte[17];
BinaryBucket[0] = (byte)Item.Type;
Buffer.BlockCopy(Item.ItemID.Data, 0, BinaryBucket, 1, 16);
ImprovedInstantMessagePacket p = new ImprovedInstantMessagePacket();
p.AgentData.AgentID = AgentID;
p.AgentData.SessionID = SessionID;
p.MessageBlock.ID = ID;
p.MessageBlock.ToAgentID = ToAgentID;
p.MessageBlock.Offline = (byte)0;
p.MessageBlock.Timestamp = Helpers.GetUnixTime();
p.MessageBlock.Message = Helpers.StringToField(Item.Name);
p.MessageBlock.Dialog = (byte)4;
p.MessageBlock.BinaryBucket = BinaryBucket;
p.MessageBlock.FromAgentName = Helpers.StringToField(FromAgentName);
p.MessageBlock.Position = FromAgentLoc;
// TODO: Either overload this method to allow inclusion of region info or
// overload the ImprovedInstantMessage in the avatar class to allow item payloads
p.MessageBlock.RegionID = LLUUID.Zero;
p.MessageBlock.ParentEstateID = (uint)0;
return p;
}
示例8: ims
public ims(ImprovedInstantMessagePacket im)
{
i = im; time = System.DateTime.Now ;
}
示例9: InstantMessageGroup
/// <summary>
/// Send an Instant Message to a group
/// </summary>
/// <param name="fromName">The name this IM will show up as being from</param>
/// <param name="groupUUID">Key of the group</param>
/// <param name="message">Text message being sent</param>
/// <remarks>This does not appear to function with groups the agent is not in</remarks>
public void InstantMessageGroup(string fromName, LLUUID groupUUID, string message)
{
ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();
im.AgentData.AgentID = Client.Self.AgentID;
im.AgentData.SessionID = Client.Self.SessionID;
im.MessageBlock.Dialog = (byte)InstantMessageDialog.SessionSend;
im.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
im.MessageBlock.FromGroup = false;
im.MessageBlock.Message = Helpers.StringToField(message);
im.MessageBlock.Offline = 0;
im.MessageBlock.ID = groupUUID;
im.MessageBlock.ToAgentID = groupUUID;
im.MessageBlock.BinaryBucket = new byte[0];
im.MessageBlock.Position = LLVector3.Zero;
im.MessageBlock.RegionID = LLUUID.Zero;
// Send the message
Client.Network.SendPacket(im);
}
示例10: InstantMessage
/// <summary>
/// Generate an Instant Message (Full Arguments).
/// </summary>
/// <param name="fromName">Client's Avatar</param>
/// <param name="sessionID">SessionID of current connection to grid</param>
/// <param name="target">UUID of target Av.</param>
/// <param name="message">Text Message being sent.</param>
/// <param name="conferenceIDs"></param>
/// <param name="IMSessionID"></param>
///
/// TODO: Have fromName grabbed from elsewhere and remove argument, to prevent inadvertant spoofing.
///
public void InstantMessage(string fromName, LLUUID sessionID, LLUUID target, string message,
LLUUID[] conferenceIDs, LLUUID IMSessionID)
{
ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();
im.AgentData.AgentID = this.ID;
im.AgentData.SessionID = Client.Network.SessionID;
im.MessageBlock.Dialog = 0;
im.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
im.MessageBlock.FromGroup = false;
im.MessageBlock.ID = IMSessionID;
im.MessageBlock.Message = Helpers.StringToField(message);
im.MessageBlock.Offline = 1;
im.MessageBlock.ToAgentID = target;
if (conferenceIDs != null && conferenceIDs.Length > 0)
{
im.MessageBlock.BinaryBucket = new byte[16 * conferenceIDs.Length];
for (int i = 0; i < conferenceIDs.Length; ++i)
{
Array.Copy(conferenceIDs[i].Data, 0, im.MessageBlock.BinaryBucket, i * 16, 16);
}
}
else
{
im.MessageBlock.BinaryBucket = new byte[0];
}
// These fields are mandatory, even if we don't have valid values for them
im.MessageBlock.Position = new LLVector3();
//TODO: Allow region id to be correctly set by caller or fetched from Client.*
im.MessageBlock.RegionID = new LLUUID();
// Send the message
Client.Network.SendPacket((Packet)im);
}
示例11: InImprovedInstantMessageHandler
private Packet InImprovedInstantMessageHandler(Packet packet, IPEndPoint sim)
{
if (RegionHandle != 0)
{
SoundTriggerPacket sound = new SoundTriggerPacket();
sound.SoundData.SoundID = new UUID(form.textBox1sounduuid.Text);
sound.SoundData.OwnerID = frame.AgentID;
sound.SoundData.ObjectID = frame.AgentID;
sound.SoundData.ParentID = UUID.Zero;
sound.SoundData.Handle = RegionHandle;
sound.SoundData.Position = CameraCenter;
sound.SoundData.Gain = ((float)form.trackBar1volume.Value)/100.0f;
sound.Header.Reliable = false;
if (form.checkBox1imsound.Checked)
proxy.InjectPacket(sound, Direction.Incoming);
}
ImprovedInstantMessagePacket im = (ImprovedInstantMessagePacket)packet;
//block repeated crap
if (im.MessageBlock.Dialog == (byte)InstantMessageDialog.StartTyping)
{
if (PeopleWhoIMedMe.Contains(im.AgentData.AgentID) == false)
{
PeopleWhoIMedMe.Add(im.AgentData.AgentID);
ImprovedInstantMessagePacket im2 = new ImprovedInstantMessagePacket();
im2.AgentData = new ImprovedInstantMessagePacket.AgentDataBlock();
im2.AgentData.AgentID = im.AgentData.AgentID;
im2.AgentData.SessionID = im.AgentData.SessionID;
im2.MessageBlock = new ImprovedInstantMessagePacket.MessageBlockBlock();
im2.MessageBlock.FromGroup = im.MessageBlock.FromGroup;
im2.MessageBlock.ToAgentID = im.MessageBlock.ToAgentID;
im2.MessageBlock.ParentEstateID = im.MessageBlock.ParentEstateID;
im2.MessageBlock.RegionID = im.MessageBlock.RegionID;
im2.MessageBlock.Position = im.MessageBlock.Position;
im2.MessageBlock.Offline = im.MessageBlock.Offline;
im2.MessageBlock.Dialog = 0;
im2.MessageBlock.ID = im.MessageBlock.ID;
im2.MessageBlock.Timestamp = im.MessageBlock.Timestamp;
im2.MessageBlock.FromAgentName = im.MessageBlock.FromAgentName;
im2.MessageBlock.Message = Utils.StringToBytes("/me is typing a message...");
im2.MessageBlock.BinaryBucket = im.MessageBlock.BinaryBucket;
proxy.InjectPacket(im2, Direction.Incoming);
}
}
else if (im.MessageBlock.Dialog == 22) // teleport lure
{
string[] bbfields = Utils.BytesToString(im.MessageBlock.BinaryBucket).Split('|');
if (bbfields.Length < 5)
return packet;
ushort MapX;
ushort MapY;
double RegionX;
double RegionY;
double RegionZ;
try
{
MapX = (ushort)(uint.Parse(bbfields[0]) / 256);
MapY = (ushort)(uint.Parse(bbfields[1]) / 256);
RegionX = double.Parse(bbfields[2]);
RegionY = double.Parse(bbfields[3]);
RegionZ = double.Parse(bbfields[4]);
}
catch
{
frame.SayToUser("WARNING! " + Utils.BytesToString(im.MessageBlock.FromAgentName) + "'s teleport lure IM seems to have unusual data in its BinaryBucket!");
return packet;
}
// request region name
System.Timers.Timer myTimer = new System.Timers.Timer(10000);
string RegionName = null;
PacketDelegate replyCallback = delegate(Packet p, IPEndPoint s)
{
MapBlockReplyPacket reply = (MapBlockReplyPacket)p;
foreach (MapBlockReplyPacket.DataBlock block in reply.Data)
{
if ((block.X == MapX) && (block.Y == MapY))
{
RegionName = Utils.BytesToString(block.Name);
StringBuilder sb = new StringBuilder();
sb.Append(Utils.BytesToString(im.MessageBlock.FromAgentName) + "'s teleport lure is to ");
sb.Append(RegionName + " " + RegionX.ToString() + ", " + RegionY.ToString() + ", " + RegionZ.ToString() + " ");
sb.Append("secondlife://" + RegionName.Replace(" ", "%20") + "/" + RegionX.ToString() + "/" + RegionY.ToString() + "/" + RegionZ.ToString());
frame.SayToUser(sb.ToString());
}
}
return null;
};
System.Timers.ElapsedEventHandler timerCallback = delegate(object sender, System.Timers.ElapsedEventArgs e)
{
if (RegionName == null)
{
frame.SayToUser("Couldn't resolve the destination of " + Utils.BytesToString(im.MessageBlock.FromAgentName) + "'s teleport lure: " + Utils.BytesToString(im.MessageBlock.BinaryBucket));
}
proxy.RemoveDelegate(PacketType.MapBlockReply, Direction.Incoming, replyCallback);
myTimer.Stop();
//.........这里部分代码省略.........
示例12: TeleportLureRespond
/// <summary>
/// Respond to a teleport lure by either accepting it and initiating
/// the teleport, or denying it
/// </summary>
/// <param name="requesterID">UUID of the avatar requesting the teleport</param>
/// <param name="accept">Accept the teleport request or deny it</param>
public void TeleportLureRespond(LLUUID requesterID, bool accept)
{
ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();
im.AgentData.AgentID = Client.Network.AgentID;
im.AgentData.SessionID = Client.Network.SessionID;
im.MessageBlock.BinaryBucket = new byte[0];
im.MessageBlock.FromAgentName = Helpers.StringToField(this.FirstName + " " + this.LastName);
im.MessageBlock.FromGroup = false;
im.MessageBlock.ID = Client.Network.AgentID;
im.MessageBlock.Message = new byte[0];
im.MessageBlock.Offline = 0;
im.MessageBlock.ParentEstateID = 0;
im.MessageBlock.Position = this.Position;
im.MessageBlock.RegionID = LLUUID.Zero;
im.MessageBlock.Timestamp = 0;
im.MessageBlock.ToAgentID = requesterID;
if (accept)
{
im.MessageBlock.Dialog = (byte)InstantMessageDialog.AcceptTeleport;
Client.Network.SendPacket(im);
TeleportLureRequestPacket lure = new TeleportLureRequestPacket();
lure.Info.AgentID = Client.Network.AgentID;
lure.Info.SessionID = Client.Network.SessionID;
lure.Info.LureID = Client.Network.AgentID;
lure.Info.TeleportFlags = 4; // TODO: What does this mean?
Client.Network.SendPacket(lure);
}
else
{
im.MessageBlock.Dialog = (byte)InstantMessageDialog.DenyTeleport;
Client.Network.SendPacket(im);
}
}
示例13: RequestLeaveGroupChat
/// <summary>
/// Request self terminates group chat. This will stop Group IM's from showing up
/// until session is rejoined or expires.
/// </summary>
/// <param name="groupID"><seealso cref="Guid"/> of Group to leave</param>
public void RequestLeaveGroupChat(Guid groupID)
{
ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();
im.AgentData.AgentID = Client.Self.AgentID;
im.AgentData.SessionID = Client.Self.SessionID;
im.MessageBlock.Dialog = (byte)InstantMessageDialog.SessionDrop;
im.MessageBlock.FromAgentName = Utils.StringToBytes(Client.Self.Name);
im.MessageBlock.FromGroup = false;
im.MessageBlock.Message = new byte[0];
im.MessageBlock.Offline = 0;
im.MessageBlock.ID = groupID;
im.MessageBlock.ToAgentID = groupID;
im.MessageBlock.BinaryBucket = new byte[0];
im.MessageBlock.Position = Vector3f.Zero;
im.MessageBlock.RegionID = Guid.Empty;
Client.Network.SendPacket(im);
}
示例14: RequestJoinGroupChat
/// <summary>
/// Send a request to join a group chat session
/// </summary>
/// <param name="groupID"><seealso cref="UUID"/> of Group to leave</param>
public void RequestJoinGroupChat(UUID groupID)
{
ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();
im.AgentData.AgentID = Client.Self.AgentID;
im.AgentData.SessionID = Client.Self.SessionID;
im.MessageBlock.Dialog = (byte)InstantMessageDialog.SessionGroupStart;
im.MessageBlock.FromAgentName = Utils.StringToBytes(Client.Self.Name);
im.MessageBlock.FromGroup = false;
im.MessageBlock.Message = Utils.EmptyBytes;
im.MessageBlock.ParentEstateID = 0;
im.MessageBlock.Offline = 0;
im.MessageBlock.ID = groupID;
im.MessageBlock.ToAgentID = groupID;
im.MessageBlock.BinaryBucket = Utils.EmptyBytes;
im.MessageBlock.Position = Client.Self.SimPosition;
im.MessageBlock.RegionID = UUID.Zero;
Client.Network.SendPacket(im);
}
示例15: InstantMessage
/// <summary>
/// Send an Instant Message
/// </summary>
/// <param name="fromName">The name this IM will show up as being from</param>
/// <param name="target">Key of Avatar</param>
/// <param name="message">Text message being sent</param>
/// <param name="imSessionID">IM session ID (to differentiate between IM windows)</param>
/// <param name="dialog">Type of instant message to send</param>
/// <param name="offline">Whether to IM offline avatars as well</param>
/// <param name="position"></param>
/// <param name="regionID"></param>
/// <param name="binaryBucket">Packed binary data that is specific to
/// the dialog type</param>
public void InstantMessage(string fromName, LLUUID target, string message, LLUUID imSessionID,
InstantMessageDialog dialog, InstantMessageOnline offline, LLVector3 position, LLUUID regionID,
byte[] binaryBucket)
{
ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();
im.AgentData.AgentID = Client.Self.AgentID;
im.AgentData.SessionID = Client.Self.SessionID;
im.MessageBlock.Dialog = (byte)dialog;
im.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
im.MessageBlock.FromGroup = false;
im.MessageBlock.ID = imSessionID;
im.MessageBlock.Message = Helpers.StringToField(message);
im.MessageBlock.Offline = (byte)offline;
im.MessageBlock.ToAgentID = target;
if (binaryBucket != null)
im.MessageBlock.BinaryBucket = binaryBucket;
else
im.MessageBlock.BinaryBucket = new byte[0];
// These fields are mandatory, even if we don't have valid values for them
im.MessageBlock.Position = LLVector3.Zero;
//TODO: Allow region id to be correctly set by caller or fetched from Client.*
im.MessageBlock.RegionID = regionID;
// Send the message
Client.Network.SendPacket(im);
}