internal void HandleOnCtcpRequest(object sender, CtcpEventArgs e) { if (OnCtcpRequest != null) { OnCtcpRequest(this, e); } }
void CtcpVersion(object s, CtcpEventArgs e) { if (e.CtcpCommand.Equals("version", StringComparison.OrdinalIgnoreCase)) { irc.SendMessage(SendType.CtcpReply, e.Data.Nick, "VERSION " + irc.CtcpVersion); } }
private void Session_CtcpCommandReceived(object sender, CtcpEventArgs e) { if (App.IsIgnoreMatch(e.From, IgnoreActions.Ctcp)) { return; } if (((this.IsChannel && this.Target.Equals(e.To)) || (this.IsNickname && this.Target.Equals(new IrcTarget(e.From)) && !e.To.IsChannel)) && e.Command.Command == "ACTION") { string text = string.Join(" ", e.Command.Arguments); bool attn = false; if (App.IsAttentionMatch(this.Session.Nickname, text)) { attn = true; if (_window != null) { Interop.WindowHelper.FlashWindow(_window); } } this.Write("Action", string.Format("{0} {1}", e.From.Nickname, text, attn)); } else if (this.IsServer && e.Command.Command != "ACTION" && e.From != null) { this.Write("Ctcp", e.From, string.Format("[CTCP {1}] {2}", e.From.Nickname, e.Command.Command, e.Command.Arguments.Length > 0 ? string.Join(" ", e.Command.Arguments) : ""), false); } }
private static void OnCtcpRequest(object sender, CtcpEventArgs e) { string from = e.Data.Nick; switch (e.CtcpCommand.ToUpper()) { case "CLIENTINFO": client.SendMessage(SendType.CtcpReply, from, "CLIENTINFO Supported CTCP commands: CLIENTINFO FACTION PING VERSION"); break; case "FACTION": if (!crcNicks.ContainsKey(from)) { crcNicks[from] = "actor_stalker"; client.SendMessage(SendType.CtcpRequest, from, "FACTION"); } client.SendMessage(SendType.CtcpReply, from, "FACTION " + CRCOptions.GetFaction()); break; case "PING": client.SendMessage(SendType.CtcpReply, from, "PING " + e.CtcpParameter); break; case "VERSION": client.SendMessage(SendType.CtcpReply, from, "VERSION Chernobyl Relay Chat " + Application.ProductVersion); break; } }
public static void OnCtcpRequest(IrcClient client, CtcpEventArgs ev) { try { if (ev.CtcpCommand == "PING") { client.WriteLine($"NOTICE {ev.Data.Nick} :PONG PONG!"); } else if (ev.CtcpCommand == "FINGER") { client.WriteLine($"NOTICE {ev.Data.Nick} :FINGER Whatc'ya doin!?"); } else if (ev.CtcpCommand == "VERSION") { client.WriteLine($"NOTICE {ev.Data.Nick} :VERSION {client.CtcpVersion}"); } else if (ev.CtcpCommand == "USERINFO") { client.WriteLine($"NOTICE {ev.Data.Nick} :USERINFO {client.CtcpVersion}"); } else if (ev.CtcpCommand == "CLIENTINFO") { client.WriteLine($"NOTICE {ev.Data.Nick} :USERINFO {client.CtcpVersion}"); } else if (ev.CtcpCommand == "SOURCE") { client.WriteLine($"NOTICE {ev.Data.Nick} :USERINFO {client.CtcpVersion}"); } } catch (Exception ex) { Logger.ExceptionLogger(ex); } }
void ClientOnCtcpRequest(object sender, CtcpEventArgs e) { _events.Enqueue(new IrcEvent { Type = IrcEvent.EventType.CtcpRequest, Event = e }); _waitHandle.Set(); }
void Ctcp(object s, CtcpEventArgs e) { var ctcpCmd = e.CtcpCommand; if (!string.IsNullOrEmpty(e.CtcpParameter)) { ctcpCmd += e.CtcpParameter; } log.Message("Received a CTCP {0} from {1}", ctcpCmd, e.Data.Nick); }
void ClientOnOnCtcpReply(object sender, CtcpEventArgs ctcpEventArgs) { try{ var strTime = ctcpEventArgs.CtcpParameter; var semicolonIdx = strTime.IndexOf(':'); var timeStr = strTime.Substring(semicolonIdx - 2, 5); var hourStr = timeStr.Substring(0, 2); var hour = int.Parse(hourStr); var diff = hour - DateTime.Now.Hour; var userNick = ctcpEventArgs.Data.Nick; var userChannel = _activeCtcp.Where(usr => usr.Nick.Equals(userNick)).ToList()[0].Channel; _usersToGreet.Add(new User(userNick, userChannel, diff)); } catch (Exception e) { int g = 5; } }
private static void OnCtcpReply(object sender, CtcpEventArgs e) { string from = e.Data.Nick; switch (e.CtcpCommand.ToUpper()) { case "CLIENTINFO": if (e.CtcpParameter.Contains("FACTION")) { crcNicks[from] = "actor_stalker"; client.SendMessage(SendType.CtcpRequest, from, "FACTION"); } break; case "FACTION": crcNicks[from] = CRCStrings.ValidateFaction(e.CtcpParameter); break; } }
private void Session_CtcpCommandReceived(object sender, CtcpEventArgs e) { if (App.IsIgnoreMatch(e.From, IgnoreActions.Ctcp)) { return; } var session = sender as IrcSession; if (!e.IsResponse) { switch (e.Command.Command) { case "VERSION": session.SendCtcp(new IrcTarget(e.From), new CtcpCommand( "VERSION", App.Product, App.Version), true); break; case "PING": session.SendCtcp(new IrcTarget(e.From), new CtcpCommand( "PONG", e.Command.Arguments.Length > 0 ? e.Command.Arguments[0] : null), true); break; case "CLIENTINFO": session.SendCtcp(new IrcTarget(e.From), new CtcpCommand( "CLIENTINFO", "VERSION", "PING", "CLIENTINFO", "ACTION"), true); break; case "DCC": var args = e.Command.Arguments; e.Handled = this.HandleDcc(session, new IrcTarget(e.From), args); break; } } }
protected virtual void HandleCtcpRequest(object sender, CtcpEventArgs e) { OnCTCPRequest(new CTCPEventArgs(e)); if (!DefaultCTCPHandlerEnabled) { return; } try { switch (e.CtcpCommand) { case "VERSION": Client.SendMessage(SendType.CtcpReply, e.Data.Nick, "VERSION " + Config.CtcpVersionResponse); break; case "FINGER": Client.SendMessage(SendType.CtcpReply, e.Data.Nick, "FINGER " + Config.CtcpFingerResponse); break; case "PING": if (e.Data.Message.Length > 7) { Client.SendMessage(SendType.CtcpReply, e.Data.Nick, "PONG " + e.Data.Message.Substring(6, e.Data.Message.Length - 7)); } else { Client.SendMessage(SendType.CtcpReply, e.Data.Nick, "PONG"); } break; } } catch (Exception exc) { Logger.LogWarning("exception while handling CTCP request: {Exception}", exc); } }
void irc_OnCtcpRequest(object sender, CtcpEventArgs e) { string Nick = e.Data.Nick; switch (e.CtcpCommand.ToUpper()) { case "PING": case "TIME": case "ERRMSG": irc.RfcNotice(Nick, "f**k off!"); break; case "FINGER": irc.RfcPrivmsg(Nick, "Hey!! Do i kNoW yOu?? Oh Geez!! Remember tO AsK iF YoU rEAlLy wAnT tO kNoW! " + "d00d!! WhY?? aRe Ya aShAme of YasElF?? oH yEaH!! I reMeMbeR yA... Ya aRe jUsT a f*****g LamER!!" + "aCk!! GeT yA dIrtY hAndS oFf mE, SucKeR!! :P I sAiD f**k OfF d00d!! DaMn YoU!!!!!!!!!!!!!!!!"); break; case "VER": case "VERSION": irc.RfcNotice(Nick, "7th Authorized Edition (Enhanced) 2009 by TooL"); break; } }
public void PluginsOnCtcpRequest(object sender, CtcpEventArgs e) { OnCtcpRequest(this, e); }
protected virtual void HandleCtcpReply(object sender, CtcpEventArgs e) { OnCTCPReply(new CTCPEventArgs(e)); }
public CTCPEventArgs([NotNull] CtcpEventArgs ctcpArgs) { CTCPArgs = ctcpArgs; RawMessage = new RawMessageEventArgs(ctcpArgs.Data); }