public void Notify(Channel frontend, string message, ISession localSession, IIrcClient client, IUser user) { var existing = localSession.CreateCriteria <CrossChannel>() .Add(Restrictions.Eq("FrontendChannel", frontend)) .UniqueResult <CrossChannel>(); if (existing == null) { this.Logger.ErrorFormat("Attempted notification for non-existent configuration."); throw new Exception("Cannot find cross-channel configuration for this channel."); } if (this.RateLimit(user, existing.Id)) { this.Logger.InfoFormat("Rate limited notification response for {0} in {1}", user, frontend); return; } client.SendNotice( existing.BackendChannel.Name, string.Format(existing.NotifyMessage, user.Nickname, frontend.Name, message)); }