implemented some not tested kick

This commit is contained in:
Paul Schneider 2019-06-14 10:03:51 +01:00
commit 41704aedc4
26 changed files with 756 additions and 185 deletions

View file

@ -22,12 +22,15 @@ namespace Yavsc.Services
private IHubContext hubContext;
ApplicationDbContext _dbContext;
IConnexionManager _cxManager;
public YavscMessageSender(
ILoggerFactory loggerFactory,
IOptions<SiteSettings> sitesOptions,
IOptions<SmtpSettings> smtpOptions,
IEmailSender emailSender,
ApplicationDbContext dbContext
ApplicationDbContext dbContext,
IConnexionManager cxManager
)
{
_logger = loggerFactory.CreateLogger<MailSender>();
@ -35,7 +38,9 @@ namespace Yavsc.Services
siteSettings = sitesOptions?.Value;
hubContext = GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
_dbContext = dbContext;
_cxManager = cxManager;
}
public async Task <MessageWithPayloadResponse> NotifyEvent<Event>
(IEnumerable<string> userIds, Event ev)
where Event : IEvent
@ -82,7 +87,7 @@ namespace Yavsc.Services
var body = ev.CreateBody();
var cxids = ChatHub.ChatUserNames.Where (kv=>kv.Value == user.UserName).Select(kv => kv.Key).ToArray();
var cxids = _cxManager.GetConnexionIds(user.UserName).ToArray();
if (cxids.Length==0)
{