internal void ActionNotify(IrcUser user, StringStream text) { if (ActionReceived != null) { ActionReceived(user, text); } }
internal void TextNotify(IrcUser user, StringStream text) { if (TextReceived != null) { TextReceived(user, text); } }
internal void NoticeReceivedNotify(IrcUser user, StringStream text) { if (NoticeReceived != null) { NoticeReceived(user, text); } }
internal void MsgReceivedNotify(IrcUser user, StringStream text) { if (MsgReceived != null) { MsgReceived(user, text); } }
/// <summary> /// Convert bytes into IrcPackets /// </summary> public IrcPacket[] ExtractPackets(ByteBuffer partialResponse) { var str = partialResponse.GetString(encoding); var response = lastResponsePart + str; var ss = new StringStream(response); var packets = new List <IrcPacket>(3); while (ss.HasNext) { var content = ss.NextWord(PacketTerminator); if (!ss.HasNext && !response.EndsWith(PacketTerminator)) { lastResponsePart = content; } else { try { var packet = CreatePacket(content); packets.Add(packet); if (!ss.HasNext) { lastResponsePart = ""; } } catch (Exception e) { throw new Exception("Unable to parse packet: " + content, e); } } } return(packets.ToArray()); }
internal void ActionNotify(IrcUser user, IrcChannel channel, StringStream text) { if (channel != null) { channel.ActionNotify(user, text); } OnAction(user, channel, text); }
internal void ChatMessageReceivedNotify(DccChatClient client, StringStream text) { if (ChatMessageReceived != null) { ChatMessageReceived(client, text); } if (m_irc.TriggersCommand(client.User, null, text)) { m_irc.CommandHandler.Execute(new DccChatCmdTrigger(text, client.User)); } }
public virtual bool TriggersCommand(IrcUser user, IrcChannel chan, StringStream input) { return(CommandHandler.RemoteCommandPrefixes.Iterate(prefix => { if (input.String.StartsWith(prefix, StringComparison.CurrentCultureIgnoreCase)) { input.Skip(prefix.Length); return false; } return true; })); }
internal void NoticeNotify(IrcUser user, IrcChannel chan, StringStream text) { if (chan != null) { chan.NoticeReceivedNotify(user, text); } OnNotice(user, chan, text); if (TriggersCommand(user, chan, text)) { Task.Factory.StartNew(() => m_CommandHandler.Execute(new NoticeCmdTrigger(text, user, chan))); } }
/// <summary> /// Build a packet from a new line of content from the server. /// Do as much parsing as possible here before the packet-handler /// will then work with the gathered information. /// </summary> public IrcPacket CreatePacket(string content) { var line = new StringStream(content.Trim()); string prefix; if (content[0] == ':') { prefix = line.NextWord().Substring(1); } else { prefix = line.NextWord(); } var action = line.NextWord(); var packet = new IrcPacket(irc, prefix, action, new StringStream(line.Remainder.Trim()), line.String) { protHandler = this }; return(packet); }
public NoticeCmdTrigger(StringStream args, IrcUser user, IrcChannel chan = null) : base(args, user, chan) { }
public ExecuteCmdTrigger(StringStream args, IrcUser user, IrcChannel chan) : base(args, user, chan) { }
internal void ChannelMsgNotify(IrcUser user, IrcChannel chan, StringStream text) { chan.MsgReceivedNotify(user, text); OnChannelMsg(user, chan, text); }
internal void ChannelMsgNotify(IrcUser user, IrcChannel chan, StringStream text) { chan.MsgReceivedNotify(user, text); OnChannelMsg(user, chan, text); }
internal void QueryMsgNotify(IrcUser user, StringStream text) { OnQueryMsg(user, text); }
/// <summary> /// Convert bytes into IrcPackets /// </summary> public IrcPacket[] ExtractPackets(ByteBuffer partialResponse) { var str = partialResponse.GetString(encoding); var response = lastResponsePart + str; var ss = new StringStream(response); var packets = new List<IrcPacket>(3); while (ss.HasNext) { var content = ss.NextWord(PacketTerminator); if (!ss.HasNext && !response.EndsWith(PacketTerminator)) { lastResponsePart = content; } else { try { var packet = CreatePacket(content); packets.Add(packet); if (!ss.HasNext) { lastResponsePart = ""; } } catch (Exception e) { throw new Exception("Unable to parse packet: " + content, e); } } } return packets.ToArray(); }
/// <summary> /// Fires when the Client recieves any CTCP ACTION aka /me. /// </summary> /// <param name="user">The User who sent the text</param> /// <param name="channel">The Channel where it was sent (can be null if sent to a User)</param> /// <param name="text">The text which was sent</param> protected virtual void OnAction(IrcUser user, IrcChannel channel, StringStream text) { }
internal void ActionNotify(IrcUser user, StringStream text) { if (ActionReceived != null) ActionReceived(user, text); }
internal void MsgReceivedNotify(IrcUser user, StringStream text) { if (MsgReceived != null) MsgReceived(user, text); }
/// <summary> /// Fires when the Client receives a PRIVMSG which was directed to a Channel. /// </summary> protected virtual void OnChannelMsg(IrcUser user, IrcChannel chan, StringStream text) { }
public ExecuteCmdTrigger(StringStream args, IrcUser user, IrcChannel chan) : base(args, user, chan) { }
/// <summary> /// Fires when the Client recieves any CTCP ACTION aka /me. /// </summary> /// <param name="user">The User who sent the text</param> /// <param name="channel">The Channel where it was sent (can be null if sent to a User)</param> /// <param name="text">The text which was sent</param> protected virtual void OnAction(IrcUser user, IrcChannel channel, StringStream text) { }
internal void TextNotify(IrcUser user, IrcChannel chan, StringStream text) { if (chan != null) chan.TextNotify(user, text); OnText(user, chan, text); if (TriggersCommand(user, chan, text)) { Task.Factory.StartNew(()=>m_CommandHandler.Execute(new MsgCmdTrigger(text, user, chan))); } }
internal void QueryMsgNotify(IrcUser user, StringStream text) { OnQueryMsg(user, text); }
public DccChatCmdTrigger(StringStream args, IrcUser user) : base(args, user, null) { }
public NoticeCmdTrigger(StringStream args, IrcUser user, IrcChannel chan = null) : base(args, user, chan) { }
internal void NoticeNotify(IrcUser user, IrcChannel channel, StringStream text) { OnNotice(user, channel, text); }
public virtual bool TriggersCommand(IrcUser user, IrcChannel chan, StringStream input) { return CommandHandler.RemoteCommandPrefixes.Iterate(prefix => { if (input.String.StartsWith(prefix, StringComparison.CurrentCultureIgnoreCase)) { input.Skip(prefix.Length); return false; } return true; }); }
/// <summary> /// Build a packet from a new line of content from the server. /// Do as much parsing as possible here before the packet-handler /// will then work with the gathered information. /// </summary> public IrcPacket CreatePacket(string content) { var line = new StringStream(content.Trim()); string prefix; if (content[0] == ':') { prefix = line.NextWord().Substring(1); } else { prefix = line.NextWord(); } var action = line.NextWord(); var packet = new IrcPacket(irc, prefix, action, new StringStream(line.Remainder.Trim()), line.String) { protHandler = this }; return packet; }
internal void TextNotify(IrcUser user, StringStream text) { if (TextReceived != null) TextReceived(user, text); }
public WCellCmdTrigger(WCellUser user, IrcChannel channel, WCellStr text, RealmServerCmdArgs args) : base(text, args) { Channel = channel; User = user.IrcUser; }
/// <summary> /// Fires when the Client receives any kind of NOTICE. /// </summary> /// <param name="user">The User who sent the text</param> /// <param name="channel">The Channel where it was sent (can be null)</param> /// <param name="text">The text which was sent</param> protected virtual void OnNotice(IrcUser user, IrcChannel channel, StringStream text) { }
/// <summary> /// Fires when the Client receives a PRIVMSG, directed to this Client itself. /// </summary> protected virtual void OnQueryMsg(IrcUser user, StringStream text) { }
/// <summary> /// Fires when the Client receives a PRIVMSG, directed to this Client itself. /// </summary> protected virtual void OnQueryMsg(IrcUser user, StringStream text) { }
/// <summary> /// Fires when the Client receives any kind of NOTICE. /// </summary> /// <param name="user">The User who sent the text</param> /// <param name="chan">The Channel where it was sent (is null if its a private notice)</param> /// <param name="text">The text which was sent</param> protected virtual void OnNotice(IrcUser user, IrcChannel chan, StringStream text) { }
public DccChatCmdTrigger(StringStream args, IrcUser user) : base(args, user, null) { }
internal void NoticeNotify(IrcUser user, IrcChannel channel, StringStream text) { OnNotice(user, channel, text); }
internal void ActionNotify(IrcUser user, IrcChannel channel, StringStream text) { if (channel != null) channel.ActionNotify(user, text); OnAction(user, channel, text); }
internal void ChatMessageReceivedNotify(DccChatClient client, StringStream text) { if (ChatMessageReceived != null) ChatMessageReceived(client, text); if (m_irc.TriggersCommand(client.User, null, text)) { m_irc.CommandHandler.Execute(new DccChatCmdTrigger(text, client.User)); } }
internal void NoticeReceivedNotify(IrcUser user, StringStream text) { if (NoticeReceived != null) NoticeReceived(user, text); }