public void ExecuteCommand(string cmd) { if (!(cmd.Length > 0)) { return; } bool handled = false; CommandModel cd = new CommandModel(Frontend.FrontendManager, null, (string)Frontend.UserConfig["Interface/Entry/CommandCharacter"], cmd); //handled = _Command(cd); if (!handled) { handled = Frontend.Session.Command(cd); } if (!handled) { // we may have no network manager yet Engine.IProtocolManager nm = Frontend.FrontendManager.CurrentProtocolManager; if (nm != null) { handled = nm.Command(cd); } else { handled = false; } } if (!handled) { _CommandUnknown(cd); } }
public void Parser() { var cmd = new CommandModel(null, null, "/", "/test foobar"); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual("foobar", cmd.Parameter); cmd = new CommandModel(null, null, "/", "/test foo bar"); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual("foo bar", cmd.Parameter); cmd = new CommandModel(null, null, "/", "/test foo bar"); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual(" foo bar", cmd.Parameter); cmd = new CommandModel(null, null, "/", "/test foo bar "); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual("foo bar ", cmd.Parameter); cmd = new CommandModel(null, null, "/", "/test foo bar "); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual(" foo bar ", cmd.Parameter); }
public CommandHookEnvironment(CommandModel cmd) { if (cmd == null) { throw new ArgumentNullException("cmd"); } this["CMD"] = cmd.Command; this["CMD_PARAMETER"] = cmd.Parameter; this["CMD_CHARACTER"] = cmd.CommandCharacter; }
public override bool Command(CommandModel command) { Trace.Call(command); bool handled = false; if (IsConnected) { if (command.IsCommand) { } else { _Say(command.Chat, command.Data); handled = true; } } else { if (command.IsCommand) { // commands which work even without beeing connected switch (command.Command) { case "help": CommandHelp(command); handled = true; break; case "connect": CommandConnect(command); handled = true; break; } } else { // normal text, without connection NotConnected(command); handled = true; } } return(handled); }
public void CommandMessageQuery(CommandModel cd) { ChatModel chat = null; if (cd.DataArray.Length >= 2) { string nickname = cd.DataArray[1]; JID jid = null; foreach (JID j in _RosterManager) { Item item = _RosterManager[j]; if (item.Nickname != null && item.Nickname.Replace(" ", "_") == nickname) { jid = item.JID; break; } } if (jid == null) { jid = nickname; // TODO check validity } chat = GetChat(jid, ChatType.Person); if (chat == null) { PersonModel person = new PersonModel(jid, nickname, NetworkID, Protocol, this); chat = Session.CreatePersonChat(person, jid, nickname, this); Session.AddChat(chat); Session.SyncChat(chat); } } if (cd.DataArray.Length >= 3) { string message = String.Join(" ", cd.DataArray, 2, cd.DataArray.Length - 2); // ignore empty messages if (message.TrimEnd(' ').Length > 0) { _Say(chat, message); } } }
public override bool Command(CommandModel command) { Trace.Call(command); bool handled = false; switch (command.Command) { case "j": case "join": CommandJoin(command); handled = true; break; case "say": CommandSay(command); handled = true; break; case "help": CommandHelp(command); handled = true; break; case "topic": CommandTopic(command); handled = true; break; case "uploads": CommandUploads(command); handled = true; break; default: // nothing, normal chat handled = true; if (command.Chat is GroupChatModel) { SendMessage((GroupChatModel)command.Chat, command.Data); } break; } return(handled); }
public void CommandPart(CommandModel cd) { string jid; if (cd.DataArray.Length >= 2) { jid = cd.DataArray[1]; } else { jid = cd.Chat.ID; } ChatModel chat = GetChat(jid, ChatType.Group); if (chat != null) { _ConferenceManager.GetRoom(jid + "/" + _JabberClient.User).Leave("Part"); } }
public void CommandJoin(CommandModel cmd) { Trace.Call(cmd); RefreshRooms(); /* * cmd.DataArray is split at SP, but that's an allowed character * for Campfire. Instead of relying on that, we need to remove the "/join " * part and then split on ',' */ var chans = cmd.Parameter.Split(','); var list = Rooms.Where(r => chans.Any(r.Name.Equals)); foreach (Room room in list) { var chat = new GroupChatModel(room.Id.ToString(), room.Name, null); OpenChat(cmd.FrontendManager, chat); } }
public void CommandJoin(CommandModel cmd) { Trace.Call(cmd); if (String.IsNullOrEmpty(cmd.Parameter)) { NotEnoughParameters(cmd); return; } try { Client.JoinRoom(cmd.Parameter); } catch (Exception ex) { #if LOG4NET Logger.Error(ex); #endif var msg = CreateMessageBuilder(). AppendEventPrefix(). AppendErrorText(_("Joining room failed. Reason: {0}"), ex.Message). ToMessage(); Session.AddMessageToFrontend(cmd, msg); } }
private void _CommandHelp(CommandModel cd) { var chatView = ChatViewManager.GetChat(cd.Chat); var builder = new MessageBuilder(); // TRANSLATOR: this line is used as a label / category for a // list of commands below builder.AppendHeader(_("Frontend Commands")); chatView.AddMessage(builder.ToMessage()); string[] help = { "window (number|channelname|queryname|close)", "sync", "sort", "clear", "echo data", "exec command", "detach", "list [search key]", }; foreach (string line in help) { builder = new MessageBuilder(); builder.AppendEventPrefix(); builder.AppendText(line); chatView.AddMessage(builder.ToMessage()); } }
private void _CommandClear(CommandModel cd) { ChatViewManager.CurrentChatView.Clear(); }
void CommandSort(CommandModel cmd) { var chats = new List<ChatView>(ChatViewManager.Chats); // as the sorting does 2 remoting calls, we use a background thread ThreadPool.QueueUserWorkItem(delegate { try { chats.Sort((x, y) => { if (x.ProtocolManager != null && y.ProtocolManager != null && x.ProtocolManager != y.ProtocolManager) { // REMOTING CALL 1 var xprot = x.ProtocolManager.Protocol; // REMOTING CALL 2 var yprot = y.ProtocolManager.Protocol; var prot = xprot.CompareTo(yprot); if (prot != 0) { return prot; } // theirs protocols are equal, so their network decide // REMOTING CALL 3 var xnet = x.ProtocolManager.NetworkID; // REMOTING CALL 4 var ynet = y.ProtocolManager.NetworkID; var net = xnet.CompareTo(ynet); if (net != 0) { return net; } } // their networks are equal, so their type decide var type = GetChatSortValue(y).CompareTo(GetChatSortValue(x)); if (type != 0) { return type; } // their types are equal, so their name decides return x.ID.CompareTo(y.ID); }); Gtk.Application.Invoke(delegate { for (int i = 0; i < chats.Count; i++) { Frontend.MainWindow.Notebook.ReorderChild(chats[i], i); } }); } catch (Exception ex) { #if LOG4NET _Logger.Error("CommandSort(): Exception", ex); #endif } }); }
public void ExecuteCommand(string cmd) { if (!(cmd.Length > 0)) { return; } CommandModel cd = new CommandModel( Frontend.FrontendManager, ChatViewManager.CurrentChatView.ChatModel, Settings.CommandCharacter, cmd ); if (_Command(cd)) { return; } _CommandManager.Execute(cd); }
public override bool Command(CommandModel command) { Trace.Call(command); bool handled = false; switch (command.Command) { case "j": case "join": CommandJoin(command); handled = true; break; case "say": CommandSay(command); handled = true; break; case "help": CommandHelp(command); handled = true; break; case "topic": CommandTopic(command); handled = true; break; case "uploads": CommandUploads(command); handled = true; break; default: // nothing, normal chat handled = true; if (command.Chat is GroupChatModel) SendMessage((GroupChatModel) command.Chat, command.Data); break; } return handled; }
public void CommandHelp(CommandModel cd) { MessageModel fmsg = new MessageModel(); TextMessagePartModel fmsgti; fmsgti = new TextMessagePartModel(); fmsgti.Text = _("[OscarProtocolManager Commands]"); fmsgti.Bold = true; fmsg.MessageParts.Add(fmsgti); this.Session.AddMessageToChat(cd.FrontendManager.CurrentChat, fmsg); string[] help = { "help", "connect aim/icq username password", }; foreach (string line in help) { cd.FrontendManager.AddTextToCurrentChat("-!- " + line); } }
public abstract bool Command(CommandModel cmd);
public override bool Command(CommandModel cmd) { throw new System.NotImplementedException(); }
public void CommandConnect(CommandModel cd) { FrontendManager fm = cd.FrontendManager; var server = new XmppServerModel(); if (cd.DataArray.Length >= 3) { server.Hostname = cd.DataArray[2]; } else { NotEnoughParameters(cd); return; } if (cd.DataArray.Length >= 4) { try { server.Port = Int32.Parse(cd.DataArray[3]); } catch (FormatException) { fm.AddTextToChat( cd.Chat, "-!- " + String.Format( _("Invalid port: {0}"), cd.DataArray[3])); return; } } else { NotEnoughParameters(cd); return; } if (cd.DataArray.Length >= 5) { server.Username = cd.DataArray[4]; } else { NotEnoughParameters(cd); return; } if (cd.DataArray.Length >= 6) { server.Password = cd.DataArray[5]; } else { NotEnoughParameters(cd); return; } if (cd.DataArray.Length >= 7) { server.Resource = cd.DataArray[6]; } Connect(fm, server); }
public void Parser() { var cmd = new CommandModel(null, null, "/", "/test foobar"); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual("foobar", cmd.Parameter); cmd = new CommandModel(null, null, "/", "/test"); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual("", cmd.Parameter); cmd = new CommandModel(null, null, "/", "/generate_messages 100"); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("generate_messages", cmd.Command); Assert.AreEqual("100", cmd.Parameter); cmd = new CommandModel(null, null, "/", "/test foo bar"); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual("foo bar", cmd.Parameter); cmd = new CommandModel(null, null, "/", "/test foo bar"); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual(" foo bar", cmd.Parameter); cmd = new CommandModel(null, null, "/", "/test foo bar "); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual("foo bar ", cmd.Parameter); cmd = new CommandModel(null, null, "/", "/test foo bar "); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual(" foo bar ", cmd.Parameter); cmd = new CommandModel(null, null, "/", @"/test ""foo bar"""); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual("\"foo bar\"", cmd.Parameter); Assert.AreEqual("foo bar", cmd.DataArray[1]); cmd = new CommandModel(null, null, "/", @"/test ""foo"" bar"); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual("\"foo\" bar", cmd.Parameter); Assert.AreEqual("foo", cmd.DataArray[1]); Assert.AreEqual("bar", cmd.DataArray[2]); cmd = new CommandModel(null, null, "/", @"/test """""); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("test", cmd.Command); Assert.AreEqual("\"\"", cmd.Parameter); Assert.AreEqual("", cmd.DataArray[1]); cmd = new CommandModel(null, null, "/", @"//test"); Assert.IsFalse(cmd.IsCommand); Assert.AreEqual("", cmd.Parameter); Assert.AreEqual("/test", cmd.DataArray[0]); cmd = new CommandModel(null, null, "/", @"/join [email protected] ""password with spaces"" ""nickname with spaces"""); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("join", cmd.Command); Assert.AreEqual("*****@*****.**", cmd.DataArray[1]); Assert.AreEqual("password with spaces", cmd.DataArray[2]); Assert.AreEqual("nickname with spaces", cmd.DataArray[3]); cmd = new CommandModel(null, null, "/", @"/test bla""blub"); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("bla\"blub", cmd.Parameter); Assert.AreEqual("/test", cmd.DataArray[0]); Assert.AreEqual("bla\"blub", cmd.DataArray[1]); cmd = new CommandModel(null, null, "/", @"/test ""blub"""); Assert.IsTrue(cmd.IsCommand); Assert.AreEqual("\"blub\"", cmd.Parameter); Assert.AreEqual("/test", cmd.DataArray[0]); Assert.AreEqual("blub", cmd.DataArray[1]); }
public void CommandSay(CommandModel cmd) { Trace.Call(cmd); SendMessage((GroupChatModel)cmd.Chat, cmd.Parameter); }
private void _CommandSync(CommandModel cmd) { if (Frontend.IsLocalEngine) { return; } var chatView = ChatViewManager.CurrentChatView; ThreadPool.QueueUserWorkItem(delegate { try { var oldValue = Frontend.UseLowBandwidthMode; // HACK: force a full sync Frontend.UseLowBandwidthMode = false; chatView.Sync(); Frontend.UseLowBandwidthMode = oldValue; Gtk.Application.Invoke(delegate { Frontend.UseLowBandwidthMode = false; chatView.Populate(); Frontend.UseLowBandwidthMode = oldValue; chatView.ScrollToEnd(); }); } catch (Exception ex) { Frontend.ShowError(null, ex); } }); }
public override bool Command(CommandModel command) { Trace.Call(command); bool handled = false; if (IsConnected) { if (command.IsCommand) { } else { _Say(command.Chat, command.Data); handled = true; } } else { if (command.IsCommand) { // commands which work even without beeing connected switch (command.Command) { case "help": CommandHelp(command); handled = true; break; case "connect": CommandConnect(command); handled = true; break; } } else { // normal text, without connection NotConnected(command); handled = true; } } return handled; }
public override void Run(string commandLine) { var cmd = new CommandModel(null, Chat, CommandCharacter, commandLine); ProtocolManager.Command(cmd); }
public void CommandJoin(CommandModel cmd) { Trace.Call(cmd); RefreshRooms(); /* * cmd.DataArray is split at SP, but that's an allowed character * for Campfire. Instead of relying on that, we need to remove the "/join " * part and then split on ',' */ var chans = cmd.Parameter.Split(','); var list = Rooms.Where(r => chans.Any(r.Name.Equals)); foreach(Room room in list) { var chat = new GroupChatModel(room.Id.ToString(), room.Name, null); OpenChat(cmd.FrontendManager, chat); } }
public void CommandTopic(CommandModel cmd) { Trace.Call(cmd); var update = new UpdateTopicWrapper { room = new TopicChange { topic = cmd.Parameter } }; Client.Put<object>(String.Format("/room/{0}.json", cmd.Chat.ID), update); }
public void CommandHelp(CommandModel cd) { var builder = CreateMessageBuilder(); builder.AppendEventPrefix(); // TRANSLATOR: this line is used as a label / category for a // list of commands below builder.AppendHeader(_("Campfire Commands")); Session.AddMessageToFrontend(cd, builder.ToMessage()); string[] help = { "connect campfire username password", "join", "topic", "uploads", "say" }; foreach (string line in help) { builder = CreateMessageBuilder(); builder.AppendEventPrefix(); builder.AppendText(line); Session.AddMessageToFrontend(cd, builder.ToMessage()); } }
public void CommandSay(CommandModel cd) { _Say(cd.Chat, cd.Parameter); }
public void CommandSay(CommandModel cmd) { Trace.Call(cmd); SendMessage((GroupChatModel) cmd.Chat, cmd.Parameter); }
public override void Run(string commandLine) { var cmd = new CommandModel(null, Chat, CommandCharacter, commandLine); Session.Command(cmd); }
public void CommandUploads(CommandModel cmd) { Trace.Call(cmd); var uploads = Client.Get<UploadsResponse>(String.Format("/room/{0}/uploads.json", cmd.Chat.ID)).Uploads; foreach (var upload in uploads) { var bld = CreateMessageBuilder(); bld.AppendEventPrefix().AppendHeader(_("Upload")).AppendSpace(); bld.AppendText(_("'{0}' ({1} B) {2}"), upload.Name, upload.Byte_Size, upload.Full_Url); Session.AddMessageToChat(cmd.Chat, bld.ToMessage()); } }
public void CommandPriority(CommandModel command) { if (command.DataArray.Length < 3) { var builder = CreateMessageBuilder(); builder.AppendText(_("Priority for Available is: {0}"), Server.Priorities[PresenceStatus.Online]); command.FrontendManager.AddMessageToChat(command.Chat, builder.ToMessage()); builder = CreateMessageBuilder(); builder.AppendText(_("Priority for Away is: {0}"), Server.Priorities[PresenceStatus.Away]); command.FrontendManager.AddMessageToChat(command.Chat, builder.ToMessage()); return; } string subcmd = command.DataArray[1]; int prio; if (!int.TryParse(command.DataArray[2], out prio) || prio < -128 || prio > 127) { var builder = CreateMessageBuilder(); builder.AppendText(_("Invalid Priority: {0} (valid priorities are between -128 and 127 inclusive)"), command.DataArray[2]); command.FrontendManager.AddMessageToChat(command.Chat, builder.ToMessage()); return; } var me = PresenceManager[JabberClient.JID]; JabberClient.Priority = prio; bool change_current_prio = false; switch (subcmd) { case "temp": case "temporary": change_current_prio = true; // only set priority break; case "away": Server.Priorities[PresenceStatus.Away] = prio; if (me != null) { change_current_prio = (me.Type == PresenceType.available) && (me.Show == "away"); } break; case "online": case "available": Server.Priorities[PresenceStatus.Online] = prio; if (me != null) { change_current_prio = (me.Type == PresenceType.available) && string.IsNullOrEmpty(me.Show); } break; default: return; } if (change_current_prio) { // set priority and keep all other presence info JabberClient.Presence(me.Type, me.Status, me.Show, prio); } }
void CommandGenerateMessages(CommandModel cmd) { var chat = ChatViewManager.CurrentChatView; _CommandManager.CommandGenerateMessages(cmd, chat); var builder = new MessageBuilder(); builder.AppendText( "ChatView.AddMessage(): MessageTextTagTable.Size: {0}", chat.OutputMessageTextView.MessageTextTagTable.Size ); chat.AddMessage(builder.ToMessage()); }
public void CommandRoster(CommandModel cd) { bool full = false; if (cd.Parameter == "full") { full = true; } MessageBuilder builder = CreateMessageBuilder(); builder.AppendHeader("Roster"); cd.FrontendManager.AddMessageToChat(cd.Chat, builder.ToMessage()); foreach (JID j in RosterManager) { string status = "+"; if (!PresenceManager.IsAvailable(j)) { if (!full) continue; status = "-"; } string nick = RosterManager[j].Nickname; string mesg = ""; Presence item = PresenceManager[j]; if (item != null) { if (item.Show != null && item.Show.Length != 0) { status = item.Show; } mesg = item.Status; } builder = CreateMessageBuilder(); builder.AppendText("{0}\t{1}\t({2}): {3}", status, nick, j, mesg); cd.FrontendManager.AddMessageToChat(cd.Chat, builder.ToMessage()); } }
private bool _Command(CommandModel cd) { bool handled = false; // command that work even without beeing connected if (cd.IsCommand) { switch (cd.Command) { case "help": _CommandHelp(cd); break; case "detach": _CommandDetach(cd); handled = true; break; case "window": _CommandWindow(cd); handled = true; break; case "clear": _CommandClear(cd); handled = true; break; case "list": _CommandList(cd); handled = true; break; case "sync": _CommandSync(cd); handled = true; break; case "sort": CommandSort(cd); handled = true; break; case "gc": GC.Collect(); handled = true; break; case "generate_messages": CommandGenerateMessages(cd); handled = true; break; } } return handled; }
private void _CommandDetach(CommandModel cd) { Frontend.Quit(); }
public override void OpenChat(FrontendManager fm, ChatModel chat) { Trace.Call(fm, chat); if (chat.ID == "Contacts") { OpenContactChat(); return; } CommandModel cmd = new CommandModel(fm, NetworkChat, chat.ID); switch (chat.ChatType) { case ChatType.Person: CommandMessageQuery(cmd); break; case ChatType.Group: CommandJoin(cmd); break; } }
private void _CommandList(CommandModel cd) { Frontend.OpenFindGroupChatWindow(cd.Parameter); }
private void _CommandWindow(CommandModel cd) { if (cd.DataArray.Length >= 2) { var currentChat = ChatViewManager.CurrentChatView; if (cd.Parameter.ToLower() == "close") { currentChat.Close(); } else { try { int number = Int32.Parse(cd.DataArray[1]); if (number > ChatViewManager.Chats.Count) { return; } ChatViewManager.CurrentChatNumber = number - 1; return; } catch (FormatException) { } // seems to be query- or channelname // let's see if we find something var seachKey = cd.Parameter.ToLower(); var candidates = new List<ChatView>(); foreach (var chatView in ChatViewManager.Chats) { if (chatView.Name.ToLower() != seachKey) { continue; } if (chatView == currentChat) { // we don't want to switch to ourselves continue; } // name matches // let's see if there is an exact match, if so, take it if ((chatView.GetType() == currentChat.GetType()) && (chatView.ProtocolManager == currentChat.ProtocolManager)) { candidates.Add(chatView); break; } else { // there was no exact match candidates.Add(chatView); } } if (candidates.Count == 0) { return; } ChatViewManager.CurrentChatView = candidates[0]; } } }
public override bool Command(CommandModel command) { bool handled = false; if (IsConnected) { if (command.IsCommand) { switch (command.Command) { case "help": CommandHelp(command); handled = true; break; case "msg": case "query": CommandMessageQuery(command); handled = true; break; case "say": CommandSay(command); handled = true; break; case "join": CommandJoin(command); handled = true; break; case "part": case "leave": CommandPart(command); handled = true; break; } } else { _Say(command.Chat, command.Data); handled = true; } } else { if (command.IsCommand) { // commands which work even without beeing connected switch (command.Command) { case "help": CommandHelp(command); handled = true; break; case "connect": CommandConnect(command); handled = true; break; } } else { // normal text, without connection NotConnected(command); handled = true; } } return(handled); }
public void CommandConnect(CommandModel cd) { FrontendManager fm = cd.FrontendManager; string protocol; if (cd.DataArray.Length >= 2) { protocol = cd.DataArray[1]; } else { NotEnoughParameters(cd); return; } string username; if (cd.DataArray.Length >= 3) { username = cd.DataArray[2]; } else { NotEnoughParameters(cd); return; } string password; if (cd.DataArray.Length >= 4) { password = cd.DataArray[3]; } else { NotEnoughParameters(cd); return; } Connect(fm, null, 0, username, password); }
public void CommandHelp(CommandModel cd) { MessageModel fmsg = new MessageModel(); TextMessagePartModel fmsgti; fmsgti = new TextMessagePartModel(); // TRANSLATOR: this line is used as a label / category for a // list of commands below fmsgti.Text = "[" + _("MSN Commands") + "]"; fmsgti.Bold = true; fmsg.MessageParts.Add(fmsgti); Session.AddMessageToChat(cd.Chat, fmsg); string[] help = { "help", "connect msn username password", }; foreach (string line in help) { cd.FrontendManager.AddTextToChat(cd.Chat, "-!- " + line); } }
public void CommandConnect(CommandModel cd) { FrontendManager fm = cd.FrontendManager; string user; if (cd.DataArray.Length >= 1) { user = cd.DataArray[2]; } else { NotEnoughParameters(cd); return; } string pass; if (cd.DataArray.Length >= 2) { pass = cd.DataArray[3]; } else { NotEnoughParameters(cd); return; } Connect(fm, null, 0, user, pass); }
private void _Say(CommandModel command, string text) { if (!command.Chat.IsEnabled) { return; } // string target = command.Chat.ID; // // _JabberClient.Message(target, text); MessageModel msg = new MessageModel(); TextMessagePartModel msgPart; msgPart = new TextMessagePartModel(); msgPart.Text = "<"; msg.MessageParts.Add(msgPart); msgPart = new TextMessagePartModel(); msgPart.Text = _UsersAddress; //msgPart.ForegroundColor = IrcTextColor.Blue; msgPart.ForegroundColor = new TextColor(0x0000FF); msg.MessageParts.Add(msgPart); msgPart = new TextMessagePartModel(); msgPart.Text = "> "; msg.MessageParts.Add(msgPart); msgPart = new TextMessagePartModel(); msgPart.Text = text; msg.MessageParts.Add(msgPart); Session.AddMessageToChat(command.Chat, msg); }