protected virtual void OnPrivateMessageReceived(PrivateMessageReceivedEventArgs e) { var handler = this.PrivateMessageReceived; if (handler != null) { handler(this, e); } }
public virtual void OnQueryMessageReceived(object sender, PrivateMessageReceivedEventArgs e) { }
private async void OnPrivateMessageReceived(object sender, PrivateMessageReceivedEventArgs e) { await Task.Run(() => { foreach (var command in this.registrationService.RegisteredCommands) { if (e.Message.StartsWith(command.Trigger)) { var request = this.requestFactory.Create(e.User, e.Server, e.Format, e.Broadcast, e.Message, this); command.Handler(request); } } foreach (var module in this.Modules) { module.OnQueryMessageReceived(this, e); } }); }
private void OnMessage(object sender, MessageEventArgs args) { if (args.Message.Type == MessageType.groupchat) { this.userService.GetOrCreateByHostmaskAsync(args.Message.From.Bare) // USER ? .ContinueWith(task => { var user = task.Result; var channel = new Channel() { Name = args.Message.From.ToString() } as IChannel; // CHANNEL ? var message = args.Message.Body; var eventArgs = new PublicMessageReceivedEventArgs(user, Server, channel, MessageFormat.Message, MessageBroadcast.Public, message); this.OnPublicMessageReceived(eventArgs); }); } else if (args.Message.Type == MessageType.chat) { this.userService.GetOrCreateByHostmaskAsync(args.Message.From.Bare) .ContinueWith(task => { var user = task.Result; var message = args.Message.Body; var eventArgs = new PrivateMessageReceivedEventArgs(user, Server, MessageFormat.Message, MessageBroadcast.Public, message); this.OnPrivateMessageReceived(eventArgs); }); } }
private void OnMessageReceived(object sender, IrcMessageEventArgs e) { var user = sender as IrcUser; if (user != null) { this.userService.GetOrCreateByHostmaskAsync(user.HostName).ContinueWith(task => { var eventArgs = new PrivateMessageReceivedEventArgs(task.Result, this.server, MessageFormat.Message, MessageBroadcast.Private, e.Text); this.OnPrivateMessageReceived(eventArgs); }); } }