Beispiel #1
0
 internal void AddUser(User user)
 {
   _users.Add(user);
   _usersDictionary.Add(user.Name, user);
 }
    private void MessageReceivedCore(MessageType type, string content, User user, Room room)
    {
      var text = WebUtility.HtmlDecode(content);
      var isBotAddressed = false;

      var addressMatch = _botAddressedMatcher.Match(text);
      if (addressMatch.Success)
      {
        isBotAddressed = true;
        text = addressMatch.Groups[1].Value.Trim();
      }

      using (var session = _store.OpenSession())
      {
        var message = new Message
            {
              Text = text,
              Type = type,
            };

        var context = new PluginContext
            {
              IsBotAddressed = isBotAddressed,
              BotName = _configuration.JabbrNick,
              Room = room,
              User = user,
              RavenSession = session,
              RandomProvider = _randomProvider,
              InventoryManager = _inventoryManager,
              TextProcessor = _textProcessor,
              DateTimeProvider = _dateTimeProvider
            };

        _pluginManager.ProcessMessage(message, context, _client);

        session.SaveChanges();
      }
    }