///<summary> /// Constructor /// Creates a ChatWindow and a conversation according to the type requested ///</summary> public ChatWindow(Person person, ProviderUser providerUser, ChatType type) : base(WindowType.Toplevel) { Logger.Debug("ChatWindow is being created with the ChatType: {0}", type.ToString()); this.chatType = type; conv = ConversationManager.Create(providerUser); /* * switch(chatType) { * case ChatType.Text: * conv.AddTextChannel(); * break; * case ChatType.Audio: * conv.AddAudioChannel(); * //conv.AddTextChannel(); * break; * case ChatType.Video: * conv.AddAudioVideoChannels(); * //conv.AddTextChannel(); * break; * } */ peerPerson = person; peerProviderUser = providerUser; InitWindow(); }
public static string CreateSessionString(string userId, string userName, string locale, string expires, ChatType chatType, string shardId) { Serializer serializer = Serializer.Start(); serializer.AddString("userId", userId); switch (chatType) { case ChatType.Shard: serializer.AddString("shardId", shardId); break; case ChatType.Alliance: serializer.AddString("allianceId", shardId); break; case ChatType.Raid: serializer.AddString("raidId", shardId); break; } serializer.AddString("locale", locale); serializer.AddString("userName", userName); serializer.AddString("expires", expires); serializer.AddString("chatType", chatType.ToString().ToLower()); return(serializer.End().ToString()); }
public void ChatToDebug(ChatType type, Character sender, string message, GameReader packet, GameData gameData, ExtensionHandler extensions) { if (type == ChatType.Announcement) sender.Name = ""; Debug.Information(type.ToString() + ":" + sender.Name + ": " + message); if (type == ChatType.Private && sender.Name == "Reporter") { gameData.commands.SendMessage(ChatType.Private, sender, "ECHO: " + message); } }
/// <summary> /// Logs the given chat information into the database. /// </summary> /// <param name="name">The name of the character chatting.</param> /// <param name="type">The type of chat.</param> /// <param name="toName">The character who recieved the chat.</param> /// <param name="message">The message written.</param> public static void LogChat(string name, ChatType type, string toName, string message) { using (SqlDatabaseClient client = GameServer.Database.GetClient()) { client.AddParameter("name", name); client.AddParameter("date", DateTime.Now); client.AddParameter("type", type.ToString().ToLower()); client.AddParameter("toName", toName); client.AddParameter("message", @message); client.ExecuteUpdate("INSERT INTO chat_logs (name,date,type,toname,message) VALUES(@name,@date,@type,@toName,@message);"); } }
public void ChatToDebug(ChatType type, Character sender, string message, GameReader packet, GameData gameData, ExtensionHandler extensions) { if (type == ChatType.Announcement) { sender.Name = ""; } Debug.Information(type.ToString() + ":" + sender.Name + ": " + message); if (type == ChatType.Private && sender.Name == "Reporter") { gameData.commands.SendMessage(ChatType.Private, sender, "ECHO: " + message); } }
/// <summary> /// /// </summary> /// <param name="access_token"></param> /// <param name="chatid_or_userid">type 为single时是userid,否则为chatid</param> /// <param name="op_user"></param> /// <param name="type"></param> /// <returns></returns> public static APIJsonResult ClearNotifyChat(this IQyHelper helper, string access_token, string chatid_or_userid, string op_user, ChatType type) { string url = string.Format("{0}chat/clearnotify?access_token={1}", baseUrl, access_token); return(HttpHelper.HttpPost.GetJsonResult <dynamic, GetChatResult>(url, new { op_user = op_user, chat = new { type = type.ToString(), id = chatid_or_userid } })); }
///<summary> /// Constructor /// Creates a ChatWindow based on an existing conversation. This mainly used on /// incoming conversations. ///</summary> public ChatWindow(Conversation conversation, ChatType type) : base(WindowType.Toplevel) { Logger.Debug("ChatWindow is being created with the ChatType: {0}", type.ToString()); this.chatType = type; conv = conversation; // no need to Add any channels, they will be set up already peerProviderUser = conv.PeerUser; peerPerson = PersonManager.GetPerson(peerProviderUser); InitWindow(); }
internal static bool AddMessage(MessageType type, string messageText, int messageFromIdPerson, int?messageFromIdEntity, long idChatSentInto, DateTime?sentDate, bool hasBeenSent, int messageFromIdBot, int messageIdTgFrom, ChatType type_chat_sent_into, int?photo_id, int?video_id) { const string q = "INSERT INTO Messages " + "(id, from_id_person, from_id_entity, type, " + "id_photo, id_video, message_text, id_chat_sent_into, sent_date," + " has_been_sent, from_id_bot, message_id_tg_from, type_chat_sent_into) " + "VALUES " + "(@id, @fip, @fie, @t, @idp, @idv, @mt, @icsi, @sent_date, @hbs, @fib, @mitf, @tcsi);"; var typeI = GetMessageTypeByName(type); if (typeI == null) { return(false); } var id = Tables.GetMaxId("Messages", "id"); id++; SqLite.Execute(q, new Dictionary <string, object> { { "@id", id }, { "@fip", messageFromIdPerson }, { "@fie", messageFromIdEntity }, { "@t", typeI }, { "@idp", photo_id }, { "@idv", video_id }, { "@mt", messageText }, { "@icsi", idChatSentInto }, { "@sent_date", sentDate }, { "@hbs", hasBeenSent }, { "@fib", messageFromIdBot }, { "@mitf", messageIdTgFrom }, { "@tcsi", type_chat_sent_into.ToString() } }); return(true); }
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); }
/// <summary> /// Echoes a message directly to your chat window(s). /// </summary> /// <param name="message">message</param> /// <param name="type">chat type</param> /// <returns></returns> public static int EQ2Echo(string message, ChatType type = ChatType.None) { Trace.WriteLine((type != ChatType.None) ? String.Format("Extension:EQ2Echo({0}, {1})", message, type) : String.Format("Extension:EQ2Echo({0})", message)); return (LavishScript.ExecuteCommand((type != ChatType.None) ? String.Format("EQ2Echo {0} -chattype {1}", message, type.ToString().ToLower()) : String.Format("EQ2Echo {0}", message))); }
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 static void OutputChatLogs(string text, ChatType cType = ChatType.Normal) { SMForm.chatConsole.Text += string.Format("Chat Type : {0} - {1}\r\n", cType.ToString(), text); SMForm.chatConsole.SelectionStart = SMForm.chatConsole.TextLength; SMForm.chatConsole.ScrollToCaret(); }
/// <summary> /// Displayed when objects or avatars chat in public /// </summary> public static void Chat(uint sessionNum, string fromName, string message, bool meAction, ChatType type, ChatSourceType sourceType) { string volume = ""; if (type == ChatType.Whisper) volume = "whisper"; else if (type == ChatType.Shout) volume = "shout"; else if (type != ChatType.Normal) volume = type.ToString(); ConsoleColor nameColor; ConsoleColor textColor; if (sourceType == ChatSourceType.Agent) { nameColor = ConsoleColor.Cyan; textColor = ConsoleColor.Gray; } else if (sourceType == ChatSourceType.Object) { nameColor = ConsoleColor.Green; textColor = ConsoleColor.DarkCyan; } else { nameColor = ConsoleColor.Magenta; textColor = ConsoleColor.DarkMagenta; } SetColor(ConsoleColor.DarkCyan); Console.Write("({0}) ", sessionNum); SetColor(nameColor); if (meAction) { Console.WriteLine(fromName + " " + message); } else { if (volume == "") Console.Write(fromName); else Console.Write("{0} {1}s", fromName, volume); SetColor(ConsoleColor.DarkCyan); Console.Write(": ", sessionNum); SetColor(textColor); Console.Write(message + Environment.NewLine); } SetColor(ConsoleColor.Gray); }
/// <summary> /// Echoes a message directly to your chat window(s). /// </summary> /// <param name="message">message</param> /// <param name="type">chat type</param> /// <returns></returns> public static int EQ2Echo(string message, ChatType type = ChatType.None) { Trace.WriteLine((type != ChatType.None) ? String.Format("Extension:EQ2Echo({0}, {1})", message, type) : String.Format("Extension:EQ2Echo({0})", message)); return LavishScript.ExecuteCommand((type != ChatType.None) ? String.Format("EQ2Echo {0} -chattype {1}", message, type.ToString().ToLower()) : String.Format("EQ2Echo {0}", message)); }
private List<Message> InitializeChatRoom(List<Message> messages, ChatType chatType) { client = new ChatServiceClient(chatType.ToString()); messages = client.GetChats(chatType).ToList(); currentChatType = chatType; return messages; }
Process(RestBot b, Dictionary <string, string> Parameters) { int channel = 0; bool check = true; string message = String.Empty; ChatType chattype = ChatType.Normal; if (Parameters.ContainsKey("channel")) { check &= int.TryParse(Parameters["channel"], out channel); } if (Parameters.ContainsKey("message")) { //message = Parameters["message"].ToString().Replace("+", " "); message = Parameters["message"]; } else { check = false; } // if chattype is not specified, we use normal chat by default. if (Parameters.ContainsKey("chattype")) { switch (Parameters["chattype"]) { case "shout": chattype = ChatType.Shout; break; case "whisper": chattype = ChatType.Whisper; break; default: chattype = ChatType.Normal; break; } } if (!check) { return($"<error>{MethodName}: missing required parameters</error>"); } // Make sure we are not in autopilot. // Note: Why not? (gwyneth 20220121) b.Client.Self.AutoPilotCancel(); // Note: when channel is zero, we'll attempt to use Realism.Chat instead, because it looks cooler! (gwyneth 20220121) /// <summary><c>Realism</c> is a class in <c>Openmetaverse.Utilities</c>.</summary> if (channel != 0) { b.Client.Self.Chat(message, channel, chattype); } else { Realism.Chat(b.Client, message, chattype, 3); // 3 means typing 3 characters per second (gwyneth 20220121) } return($"<{MethodName}><channel>{channel.ToString()}</channel><message>{message}</message><chattype>{chattype.ToString()}</chattype></{MethodName}>"); } // end Process