This is the patch for sending instant messages, I'll just package up
local world chat in a moment. Should be fairly obvious where this goes.

I've tested it both inworld, and with IM2Email - both appear to work
fine.

-Adam

Avatar.cs
--------------------------------------------------------------------
                public void InstantMessage(LLUUID target, string message)
                {
                        // Setup information about the 'world'
                        LLUUID RegionID = Client.CurrentRegion.ID;
                        LLVector3 Position = new LLVector3(0.0F,0.0F,0.0F);
                        TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 
1));
                        uint Now = (uint)( t.TotalSeconds );
                        string Name = Client.Avatar.FirstName + " " + 
Client.Avatar.LastName;

                        // Build the packet
                        Packet packet = 
PacketBuilder.InstantMessage(Client.Protocol, target, Client.Network.AgentID, 0,
                                RegionID, Position, 0, 0, LLUUID.GenerateUUID(), Now, 
Name, message, "");

                        // Send the message
                        Client.Network.SendPacket(packet);
                }

Packet.cs
---------------------------------------------------------------------
                public static Packet InstantMessage(ProtocolManager protocol, 
LLUUID targetAgentID, LLUUID myAgentID,
                        uint parentEstateID, LLUUID regionID, LLVector3 
position, byte offline, byte dialog, LLUUID id,
                        uint timestamp, string myAgentName, string message, 
string binaryBucket)
                {
                        Hashtable blocks = new Hashtable();
                        Hashtable fields = new Hashtable();

                        fields["FromAgentID"] = myAgentID;
                        fields["ToAgentID"] = targetAgentID;
                        fields["ParentEstateID"] = parentEstateID;
                        fields["RegionID"] = regionID;
                        fields["Position"] = position;
                        fields["Offline"] = offline;
                        fields["Dialog"] = dialog;
                        fields["ID"] = id;
                        fields["Timestamp"] = timestamp;
                        fields["FromAgentName"] = myAgentName;
                        fields["Message"] = message;
                        fields["BinaryBucket"] = binaryBucket;
                        blocks[fields] = "MessageBlock";

                        Packet packet = 
PacketBuilder.BuildPacket("ImprovedInstantMessage", protocol, blocks);
                        return packet;


_______________________________________________
libsecondlife-dev mailing list
libsecondlife-dev@gna.org
https://mail.gna.org/listinfo/libsecondlife-dev

Reply via email to