org.xwiki.netflux.internal.HistoryKeeper Maven / Gradle / Ivy
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.netflux.internal;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import org.slf4j.Logger;
import org.xwiki.component.annotation.Component;
/**
* Holds the key of the history keeper fake user that is added to all Netflux channels.
*
* @version $Id: c016057a74e0e2287b86f0c84dad5fdfca91ecfd $
* @since 13.9RC1
*/
@Component
@Singleton
@Named("HistoryKeeper")
public class HistoryKeeper extends AbstractBot
{
@Inject
private Logger logger;
@Inject
private ChannelStore channels;
@Inject
private MessageDispatcher dispatcher;
@Override
public String getId()
{
// The client side identifies the history keeper by the id length, expecting 16 characters, so we have to reduce
// the id length compared to other bots.
return super.getId().substring(0, 16);
}
@Override
public void onUserMessage(User sender, List