Projects tigase _server server-core Issues #1445
How to make sync chat message after login disable. (#1445)
Closed
Unknown opened 3 years ago

I have a problem with… I use jaxmpp client and it will receive history message after login.I did not found history chat message saved in database and where they store?And how can I filter history chat message?

Details (please complete the following information):

  • Tigase version: [e.g. 8.1.2]
  • JVM flavour and version [e.g. JDK 11]
  • Operating system/distribution/version [e.g. Linux CentOS 7]

Jaxmpp login code:

Jaxmpp contact = new Jaxmpp();
Presence.initialize(contact);

contact.getModulesManager().register(new MessageModule());

contact.getProperties().setUserProperty(SessionObject.USER_BARE_JID, BareJID.bareJIDInstance(userName));
contact.getProperties().setUserProperty(SessionObject.PASSWORD, request.getPassword());

contact.getEventBus().addHandler(MessageModule.MessageReceivedHandler.MessageReceivedEvent.class, new MessageModule.MessageReceivedHandler() {
                @Override
                public void onMessageReceived(SessionObject sessionObject, Chat chat, Message stanza) {
                    try {
                        String sender = stanza.getFrom().getBareJid().toString();
                        String recver = stanza.getTo().getBareJid().toString();
                        String subject = stanza.getSubject();
                        String message = stanza.getBody();
                        logger.info("message: " + sender + " " + recver + " " + subject + " " + message);
                    } catch (XMLException e) {
                        logger.error("recv message parse xml error", e);
                    }
                }
            });

contact.login(true);

And logger.info("message: " + sender + " " + recver + " " + subject + " " + message) always display history chat message on console after login.

Unknown commented 3 years ago

Is this the question about chat history in the Jaxmpp (if so - please ask it in the Jaxmpp project: https://github.com/tigase/jaxmpp/).

If you are asking about chat history in the server then it's handled by XEP-0313: Message Archive Management and https://github.com/tigase/tigase-message-archiving component. It's included in the distribution package and should be enabled by default.

Please keep in mind, that you either have to enable globally, per-VHost configuration or user should enable it. Take a look at:

Unknown commented 3 years ago

@woj-tek Thank you very much!

issue 1 of 1
Type
Question
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1445
Please wait...
Page is in error, reload to recover