private void SendTypingPackets(QueuedInterestListEvent[] eventDatas, IScenePresence presence) { if (!(presence is LLAgent) || presence.InterestList == null) { return; } LLAgent agent = (LLAgent)presence; // We can't combine chat blocks together, so send a packet for each typing event // that is pulled off the event queue for (int i = 0; i < eventDatas.Length; i++) { TypingData data = (TypingData)eventDatas[i].Event.State; ChatAudibleLevel audible = GetAudibleLevel(data.Source.ScenePosition, presence.ScenePosition, NORMAL_DIST); ChatFromSimulatorPacket packet = new ChatFromSimulatorPacket(); packet.ChatData.Audible = (byte)audible; packet.ChatData.ChatType = (byte)(data.StartTyping ? ChatType.StartTyping : ChatType.StopTyping); packet.ChatData.FromName = Utils.StringToBytes(data.Source.Name); packet.ChatData.Message = Utils.EmptyBytes; packet.ChatData.OwnerID = data.Source.OwnerID; packet.ChatData.Position = data.Source.ScenePosition; packet.ChatData.SourceID = data.Source.ID; packet.ChatData.SourceType = (byte)ChatSourceType.Agent; m_udp.SendPacket(agent, packet, ThrottleCategory.Task, false); } }
void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { if (message.Length > 0 && Client.MasterKey == id) { Client.Self.Chat(message, 0, ChatType.Normal); } }
void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype, string fromName, UUID id, UUID ownerid, Vector3 position) { if (message.Length > 0 && (Client.MasterKey == id || (Client.MasterName == fromName && !Client.AllowObjectMaster))) { Client.Self.Chat(message, 0, ChatType.Normal); } }
static void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { if (fromName != _Client.Self.Name && type == ChatType.Normal && audible == ChatAudibleLevel.Fully) { string str = "<" + fromName + "> " + message; _IRC.SendMessage(_AutoJoinChannel, str); Console.WriteLine("[SL->IRC] " + str); } }
public ChatEventArgs(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { this.message = message; this.audible = audible; this.type = type; this.sourceType = sourceType; this.fromName = fromName; this.id = id; this.ownerid = ownerid; this.position = position; }
public ChatEventArgs(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { this.message = message; this.audible = audible; this.type = type; this.sourceType = sourceType; this.fromName = fromName; this.id = id; this.ownerid = ownerid; this.position = position; }
protected void ProcessChatToClients(UUID senderID, HashSet <UUID> receiverIDs, string message, ChatTypeEnum type, Vector3 fromPos, string fromName, ChatSourceType src, ChatAudibleLevel level) { if (null == m_xtw) { return; } if (ChatTypeEnum.DebugChannel == type | ChatTypeEnum.StartTyping == type | ChatTypeEnum.StopTyping == type) { return; } Player speaker; List <Player> heardBy = new List <Player>(); lock (m_controller.Game.Players) { m_controller.Game.Players.TryGetValue(senderID, out speaker); if (null == speaker) { return; } foreach (UUID receiverId in receiverIDs) { if (m_controller.Game.Players.ContainsKey(receiverId)) { heardBy.Add(m_controller.Game.Players[receiverId]); } } } lock (this) { RecordEventStart(ChatElement); m_xtw.WriteStartElement(SpeakerElement); RecordPlayerReference(speaker); m_xtw.WriteEndElement(); m_xtw.WriteStartElement(HeardByElement); foreach (Player p in heardBy) { RecordPlayerReference(p); } m_xtw.WriteEndElement(); m_xtw.WriteElementString(MessageElement, message); RecordEventEnd(); } }
private void ProcessChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, OpenMetaverse.UUID id, OpenMetaverse.UUID ownerid, OpenMetaverse.Vector3 position) { string msg = JsonUtil.SerializeMessage(JsonType.ChatReceived, new JsonChatReceived( message, (int)type, fromName, id.ToString(), ownerid.ToString(), position.X, position.Y, position.Z )); Ox.EventFire(msg, true); }
public void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { Console.WriteLine(fromName+":" + message); if (message.Length > 0 && message.ToLower().Contains(Client.Self.FirstName.ToLower()) && Client.Self.AgentID != id) { WebRequest request = WebRequest.Create("http://www.mr-technicl.com/slfutura.php?nick="+ fromName + "&message="+ message); WebResponse response = request.GetResponse(); StreamReader input = new StreamReader(response.GetResponseStream()); string say = input.ReadToEnd(); input.Close(); libsecondlife.Utilities.Realism.Chat(Client, say, ChatType.Normal, 25); } }
public void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { Hashtable item = new Hashtable(); item.Add("MessageType", "SpatialChat"); item.Add("Message", message); item.Add("Audible", audible); item.Add("Type", type); item.Add("SourceType", sourceType); item.Add("FromName", fromName); item.Add("ID", id); item.Add("OwnerID", ownerid); item.Add("Position", position); enqueue(item); }
void onChatMessageReceive(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { if ((message.Length != 0) && (message != null) && (message != String.Empty) && !(id == Self.AgentID)) { Self.AutoPilotCancel(); string[] sender = fromName.Split(' '); XmlRpcAgencyConnector.MethodName = "XmlRpcAgencyConnector.onChatMessageReceive"; XmlRpcAgencyConnector.Params.Clear(); XmlRpcAgencyConnector.Params.Add(agentName); XmlRpcAgencyConnector.Params.Add(message); XmlRpcAgencyConnector.Params.Add((int)position.X); XmlRpcAgencyConnector.Params.Add((int)position.Y); XmlRpcAgencyConnector.Params.Add((int)position.Z); XmlRpcAgencyConnector.Params.Add(sender[0]); XmlRpcAgencyConnector.Params.Add(sender[1]); try { #if DEBUG Console.WriteLine("Request: " + XmlRpcAgencyConnector); #endif XmlRpcResponse response = XmlRpcAgencyConnector.Send(XmlRpcAgencyConnectorUrl); #if DEBUG Console.WriteLine("Response: " + response); #endif if (response.IsFault) { #if DEBUG Console.WriteLine("Fault {0}: {1}", response.FaultCode, response.FaultString); #endif } else { #if DEBUG Console.WriteLine("Returned: " + response.Value); #endif } } catch (Exception e) { Console.WriteLine("Exception " + e); } } }
void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { if (audible == ChatAudibleLevel.Fully && type != ChatType.StartTyping && type != ChatType.StopTyping) { Color color; if (sourceType == ChatSourceType.Agent) { color = Color.FromKnownColor(KnownColor.ControlText); } else { color = Color.FromKnownColor(KnownColor.GrayText); } LogChat(fromName, type, message, color); } }
private void chatCallback(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype, string fromName, UUID id, UUID ownerid, Vector3 position) { // This is weird -- we get start/stop typing chats from // other avatars, and we get messages back that we sent. // (Tested on OpenSim r3187) // So we explicitly check for those cases here. if ((int)type < 4 && id != m_user.Self.AgentID) { m_log.Debug("Chat: " + fromName + ": " + message); if (OnChat != null) { OnChat(message, audible, type, sourcetype, fromName, id, ownerid, position); } } }
void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { if (message.Length > 0 && Client.MasterKey == id) Client.Self.Chat(message, 0, ChatType.Normal); }
static void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { if (id == client.Self.AgentID || message == "") return; if (message == "Claudius, go away.") { Disconnect(); return; } if (message == "Claudius, info.") { string reply = fromName + ", your id is '" + id + ", your ownerId is '" + ownerid + ", and your location is '" + position + "."; client.Self.Chat(reply, 0, ChatType.Normal); client.Self.Chat("Mine is " + client.Self.SimPosition + ".", 0, ChatType.Normal); return; } if (message == "Claudius, come here.") { Console.WriteLine("About to follow"); /* client.Self.AutoPilotLocal(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), position.Z); Console.WriteLine("Going to: " + position ); */ GoToPosition(position); return; } if (message.StartsWith("Claudius, go to:")) { String dest = message.Substring(message.IndexOf(':') + 1); List<Vector3> wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, dest); TraverseWayPoints(wayPointList); return; } client.Self.Chat(message, 0, ChatType.Normal); }
void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { if (type == ChatType.StartTyping || type == ChatType.StopTyping || audible != ChatAudibleLevel.Fully) return; if (!Session.Settings.DisplayChat) return; char[] splitChar = { ' ' }; string[] msg = message.Split(splitChar); bool action; if (msg[0].ToLower() == "/me") { action = true; message = String.Join(" ", msg, 1, msg.Length - 1); } else action = false; Display.Chat(Session.SessionNumber, fromName, message, action, type, sourceType); if (id == Session.Client.Self.AgentID) return; Dictionary<string, string> identifiers = new Dictionary<string, string>(); identifiers.Add("$name", fromName); identifiers.Add("$message", message); identifiers.Add("$id", id.ToString()); identifiers.Add("$ownerid", ownerid.ToString()); identifiers.Add("$ctype", type.ToString()); identifiers.Add("$stype", sourceType.ToString()); identifiers.Add("$pos", position.ToString()); for (int i = 0; i < msg.Length; i++) identifiers.Add("$" + (i + 1), msg[i]); ScriptSystem.TriggerEvents(Session.SessionNumber, ScriptSystem.EventTypes.Chat, identifiers); }
public void OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype, string fromName, UUID id, UUID ownerid, Vector3 position) { Reference.Viewer.ChatManager.Add(message, audible, type, sourcetype, fromName, id, ownerid, position); }
public void Add(string _message, ChatAudibleLevel _audible, ChatType _type, ChatSourceType _sourcetype, string _fromName, UUID _id, UUID _ownerid, Vector3 _position) { Reference.Log.Debug(_message + " ChatAudibleLevel:" + _audible.ToString() + " ChatType:" + _type.ToString() + " ChatSourceType:" + _sourcetype.ToString() + " FromName:" + _fromName); // name. string fromName = _fromName + ":"; lock (messageHistory) { messageHistory.Add(fromName); Reference.Viewer.GuiManager.ChatAddMessage(fromName); } // message. string msg = _message; if (_message.Length > maxMessageLength) { string tail = "・・・"; msg = _message.Substring(0, maxMessageLength - tail.Length); msg += tail; } // wide-char space -> 2 char space. msg = msg.Replace(" ", " "); // trim space. msg = msg.Trim(); List<int> colLen = new List<int>(); int colMaxLen = 16 * 2; int lenCounter = 0; for (int i = 0; i < msg.Length; i++) { char c = msg[i]; if (c < '!' || '~' < c) { lenCounter += 2; } else { lenCounter += 1; } if ((lenCounter >= colMaxLen) || ((i + 1) == msg.Length)) { colLen.Add(i + 1); lenCounter = 0; } } List<string> msgList = new List<string>(); for (int i = 0; i < colLen.Count; i++) { int start = (i > 0 ? colLen[i - 1] : 0); int length = (i > 0 ? colLen[i] - colLen[i - 1] : colLen[i]); string text = msg.Substring(start, length); msgList.Add(text); } for (int i = 0; i < msgList.Count; i++) { // message. string addMessage = " " + msgList[i]; lock (messageHistory) { messageHistory.Add(addMessage); Reference.Viewer.GuiManager.ChatAddMessage(addMessage); } } Reference.Viewer.Adapter.CallReceiveMessaged(_id.ToString(), _fromName, _message); }
private void SLChat(string message, ChatAudibleLevel audible, libsecondlife.ChatType type, ChatSourceType sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { // This is weird -- we get start/stop typing chats from // other avatars, and we get messages back that we sent. // (Tested on OpenSim r3187) // So we explicitly check for those cases here. if (OnChat != null && (int) type < 4 && id != m_user.Self.AgentID) { Vector3f pos = new Vector3f(position.X, position.Y, position.Z); OnChat(message, fromName, (ChatType) type, id.UUID, ownerid.UUID, pos); } }
void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { switch (type) { case ChatType.Normal: case ChatType.Shout: Console.WriteLine("{0}>{1}", fromName, message); if (sourceType == ChatSourceType.Agent) { if (id == Self.AgentID) break; m_sixamo.Memorize(message); if (SixamoCS.Rand() > 1.0 / Math.Pow(Network.CurrentSim.ObjectsAvatars.Count - 1, 1.5)) break; Talk(); } break; } }
public void ObjectChat(object sender, UUID ownerID, UUID sourceID, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, Vector3 position, int channel, string message) { if (OnObjectChat != null) { OnObjectChat(sender, ownerID, sourceID, audible, type, sourceType, fromName, position, channel, message); } if (channel == 0) { // TODO: Reduction provider will impose the chat radius ChatFromSimulatorPacket chat = new ChatFromSimulatorPacket(); chat.ChatData.Audible = (byte)audible; chat.ChatData.ChatType = (byte)type; chat.ChatData.OwnerID = ownerID; chat.ChatData.SourceID = sourceID; chat.ChatData.SourceType = (byte)sourceType; chat.ChatData.Position = position; chat.ChatData.FromName = Utils.StringToBytes(fromName); chat.ChatData.Message = Utils.StringToBytes(message); udp.BroadcastPacket(chat, PacketCategory.Messaging); } }
/// <summary> /// Construct a new instance of the ChatEventArgs object /// </summary> /// <param name="simulator">Sim from which the message originates</param> /// <param name="message">The message sent</param> /// <param name="audible">The audible level of the message</param> /// <param name="type">The type of message sent: whisper, shout, etc</param> /// <param name="sourceType">The source type of the message sender</param> /// <param name="fromName">The name of the agent or object sending the message</param> /// <param name="sourceId">The ID of the agent or object sending the message</param> /// <param name="ownerid">The ID of the object owner, or the agent ID sending the message</param> /// <param name="position">The position of the agent or object sending the message</param> public ChatEventArgs(Simulator simulator, string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID sourceId, UUID ownerid, Vector3 position) { this.m_Simulator = simulator; this.m_Message = message; this.m_AudibleLevel = audible; this.m_Type = type; this.m_SourceType = sourceType; this.m_FromName = fromName; this.m_SourceID = sourceId; this.m_Position = position; this.m_OwnerID = ownerid; }
public void TriggerOnChatToClients( UUID senderID, HashSet<UUID> receiverIDs, string message, ChatTypeEnum type, Vector3 fromPos, string fromName, ChatSourceType src, ChatAudibleLevel level) { ChatToClientsEvent handler = OnChatToClients; if (handler != null) { foreach (ChatToClientsEvent d in handler.GetInvocationList()) { try { d(senderID, receiverIDs, message, type, fromPos, fromName, src, level); } catch (Exception e) { m_log.ErrorFormat( "[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}", e.Message, e.StackTrace); } } } }
void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype, string fromName, Guid id, Guid ownerid, Vector3 position) { if (message.Length > 0 && (Client.MasterKey == id || (Client.MasterName == fromName && !Client.AllowObjectMaster))) Client.Self.Chat(message, 0, ChatType.Normal); }
private void Patient_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { if (id != nurseID) return; if (message.Contains("water") && state == States.heart) { client.Self.Chat("Thank you.", 0, ChatType.Normal); state = States.idle; StartPatientScript(); return; } if ((message.Contains("morphine") || message.Contains("oxy") || message.Contains("alchohol")) && state == States.arm) { client.Self.Chat("Thank you.", 0, ChatType.Normal); state = States.idle; StartPatientScript(); return; } }
private void OnNetworkChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype, string fromName, UUID id, UUID ownerid, Vector3 position) { UserInterface.OnNetworkChat(message, audible, type, sourcetype, fromName, id, ownerid, position); }
private void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { if (id == client.Self.AgentID || message == "" || !message.StartsWith(FirstName)) return; if (message.ToLower().Contains("go away")) { Disconnect(); return; } if (message.ToLower().Contains("come here")) { Console.WriteLine("About to follow"); GoToPosition(position); return; } if (message.ToLower().Contains("go to:")) { String dest = message.Substring(message.IndexOf(':') + 2); List<Vector3> wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, dest); TraverseWayPoints(wayPointList); return; } if (message.ToLower().Contains("follow")) { movementState = MovementStates.following; leaderID = avatarMap[id].LocalID; GoToPosition(position); } }
void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { lock (processQueue) processQueue.Enqueue(new QueueBase(new AgentManager.ChatCallback(ProcessChat), message, audible, type, sourceType, fromName, id, ownerid, position)); }
private void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { ChatEventArgs ea = new ChatEventArgs(message, audible, type, sourceType, fromName, id, ownerid, position); if (netcomSync != null) netcomSync.BeginInvoke(new OnChatRaise(OnChatReceived), new object[] { ea }); else OnChatReceived(ea); }
void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { if (audible == ChatAudibleLevel.Fully && type != ChatType.StartTyping && type != ChatType.StopTyping) { Color color; if (sourceType == ChatSourceType.Agent) color = Color.FromKnownColor(KnownColor.ControlText); else color = Color.FromKnownColor(KnownColor.GrayText); LogChat(fromName, type, message, color); } }
protected void ProcessChatToClients(UUID senderID, HashSet<UUID> receiverIDs, string message, ChatTypeEnum type, Vector3 fromPos, string fromName, ChatSourceType src, ChatAudibleLevel level) { if (null == m_xtw) return; if (ChatTypeEnum.DebugChannel == type | ChatTypeEnum.StartTyping == type | ChatTypeEnum.StopTyping == type) return; Player speaker; List<Player> heardBy = new List<Player>(); lock (m_controller.Game.Players) { m_controller.Game.Players.TryGetValue(senderID, out speaker); if (null == speaker) return; foreach (UUID receiverId in receiverIDs) if (m_controller.Game.Players.ContainsKey(receiverId)) heardBy.Add(m_controller.Game.Players[receiverId]); } lock (this) { RecordEventStart(ChatElement); m_xtw.WriteStartElement(SpeakerElement); RecordPlayerReference(speaker); m_xtw.WriteEndElement(); m_xtw.WriteStartElement(HeardByElement); foreach (Player p in heardBy) RecordPlayerReference(p); m_xtw.WriteEndElement(); m_xtw.WriteElementString(MessageElement, message); RecordEventEnd(); } }