Intercepting messages

If I need to process/modify a message at the server before sending it out to the receiver, where is a good place to do it? Should it be in SessionImpl::deliver ()?

Thanks in Advance.

Can you provide some more details about what you’'re trying to do? Do you need to modify all messages in the system, implement a service, etc?

Regards,

Matt

Hi Matt,

I want to process all messages, make text substitutions in them or rewrite them before sending them to the client. Messages in a session as well as offline msgs.

Thanks.

Hi Matt,

Looks like the place to put a hook is in MessageRouterImpl::route(). Is this right?

Another thing: I get an error at startup:

+java.lang.NullPointerException

at org.jivesoftware.messenger.muc.HistoryStrategy$Type.valueOf(HistoryStrategy.jav a:1)

at org.jivesoftware.messenger.muc.HistoryStrategy.setTypeFromString(HistoryStrateg y.java:221)

at org.jivesoftware.messenger.muc.HistoryStrategy.setContext(HistoryStrategy.java: 241)

at org.jivesoftware.messenger.muc.spi.MultiUserChatServerImpl.initialize(MultiUser ChatServerImpl.java:483)+

Seems like it is trying to do

historyStrategy.setContext(“xmpp.muc.history”);

in MultiUserChatServerImpl::initialize, and xmpp.muc.history.type is not defined.

Thanks for the bug report. The problem was fixed and the solution will be available in the next nightly build.

Thanks,

– Gato

+java.lang.NullPointerException

at

t

org.jivesoftware.messenger.muc.HistoryStrategy$Type.va

lueOf(HistoryStrategy.java:1)

at

t

org.jivesoftware.messenger.muc.HistoryStrategy.setType

FromString(HistoryStrategy.java:221)

at

t

org.jivesoftware.messenger.muc.HistoryStrategy.setCont

ext(HistoryStrategy.java:241)

at

t

org.jivesoftware.messenger.muc.spi.MultiUserChatServer

Impl.initialize(MultiUserChatServerImpl.java:483)+

Seems like it is trying to do

historyStrategy.setContext(“xmpp.muc.history”);

in MultiUserChatServerImpl::initialize, and

xmpp.muc.history.type is not defined.

you should “insert into jiveproperty( name, propValue) valus(‘‘xmpp.muc.history.type’’,‘‘number’’)” to solve your problem.

I need to modify or reject any message passed throuch server.