Messages sent to Email


I wanna know if is possible to translate to other languages, this message:

“Broadcast: I’m currently away. Your message has been forwarded to my email address (”

Thank you very much.

Unless you change the source and build your own version for Email on Away plugin. Currently this plugins doesn’t have an option to set a custom message or add translations.


  • Decompiled with CFR 0_114.

  • Could not load the following classes:

  • org.jivesoftware.openfire.MessageRouter

  • org.jivesoftware.openfire.PresenceManager

  • org.jivesoftware.openfire.XMPPServer

  • org.jivesoftware.openfire.container.Plugin

  • org.jivesoftware.openfire.container.PluginManager

  • org.jivesoftware.openfire.interceptor.InterceptorManager

  • org.jivesoftware.openfire.interceptor.PacketInterceptor

  • org.jivesoftware.openfire.interceptor.PacketRejectedException

  • org.jivesoftware.openfire.session.Session

  • org.jivesoftware.openfire.user.User

  • org.jivesoftware.openfire.user.UserManager

  • org.jivesoftware.openfire.user.UserNotFoundException

  • org.jivesoftware.openfire.vcard.VCardManager

  • org.jivesoftware.util.EmailService

  • org.jivesoftware.util.JiveGlobals

  • org.xmpp.packet.JID

  • org.xmpp.packet.Message

  • org.xmpp.packet.Message$Type

  • org.xmpp.packet.Packet

  • org.xmpp.packet.Presence


package com.tempstop;


import org.jivesoftware.openfire.MessageRouter;

import org.jivesoftware.openfire.PresenceManager;

import org.jivesoftware.openfire.XMPPServer;

import org.jivesoftware.openfire.container.Plugin;

import org.jivesoftware.openfire.container.PluginManager;

import org.jivesoftware.openfire.interceptor.InterceptorManager;

import org.jivesoftware.openfire.interceptor.PacketInterceptor;

import org.jivesoftware.openfire.interceptor.PacketRejectedException;

import org.jivesoftware.openfire.session.Session;

import org.jivesoftware.openfire.user.User;

import org.jivesoftware.openfire.user.UserManager;

import org.jivesoftware.openfire.user.UserNotFoundException;

import org.jivesoftware.openfire.vcard.VCardManager;

import org.jivesoftware.util.EmailService;

import org.jivesoftware.util.JiveGlobals;

import org.xmpp.packet.JID;

import org.xmpp.packet.Message;

import org.xmpp.packet.Packet;

import org.xmpp.packet.Presence;

public class emailOnAway

implements Plugin,

PacketInterceptor {

private InterceptorManager interceptorManager = InterceptorManager.getInstance();

private UserManager userManager = XMPPServer.getInstance().getUserManager();

private PresenceManager presenceManager = XMPPServer.getInstance().getPresenceManager();

private EmailService emailService = EmailService.getInstance();

private MessageRouter messageRouter = XMPPServer.getInstance().getMessageRouter();

private VCardManager vcardManager = VCardManager.getInstance();

public void initializePlugin(PluginManager pManager, File pluginDirectory) {



public void destroyPlugin() {



private Message createServerMessage(String to, String from, String emailTo) {

Message message = new Message();



message.setSubject(“I’m away”);

if (JiveGlobals.getBooleanProperty((String)“plugin.emailonaway.showemail”, (boolean)true)) {

message.setBody(“I’m currently away. Your message has been forwarded to my email address (” + emailTo + “).”);

} else {

message.setBody(“I’m currently away. Your message has been forwarded to my email address.”);


return message;


public void interceptPacket(Packet packet, Session session, boolean read, boolean processed) throws PacketRejectedException {

Message msg;

String emailTo = null;

String emailFrom = null;

if (!processed && !read && packet instanceof Message && packet.getTo() != null && (msg = (Message)packet).getType() == {

try {

User userTo = this.userManager.getUser(packet.getTo().getNode());

if (this.presenceManager.getPresence(userTo).toString().toLowerCase().indexOf(“awa y”) != -1 && msg.getBody() != null) {

User userFrom;

emailTo = this.vcardManager.getVCardProperty(userTo.getUsername(), “EMAIL”);

if (!(emailTo != null && emailTo.length() != 0 || (emailTo = this.vcardManager.getVCardProperty(userTo.getUsername(), “EMAIL:USERID”)) != null && emailTo.length() != 0 || (emailTo = userTo.getEmail()) != null && emailTo.length() != 0)) {

emailTo = packet.getTo().getNode() + “@” + packet.getTo().getDomain();


if (!((emailFrom = this.vcardManager.getVCardProperty((userFrom = this.userManager.getUser(packet.getFrom().getNode())).getUsername(), “EMAIL”)) != null && emailFrom.length() != 0 || (emailFrom = this.vcardManager.getVCardProperty(userFrom.getUsername(), “EMAIL:USERID”)) != null && emailFrom.length() != 0 || (emailFrom = userFrom.getEmail()) != null && emailFrom.length() != 0)) {

emailFrom = packet.getFrom().getNode() + “@” + packet.getFrom().getDomain();


this.emailService.sendMessage(userTo.getName(), emailTo, userFrom.getName(), emailFrom, “IM”, msg.getBody(), null);

this.messageRouter.route(this.createServerMessage(packet.getFrom().getNode() + “@” + packet.getFrom().getDomain(), packet.getTo().getNode() + “@” + packet.getTo().getDomain(), emailTo));



catch (UserNotFoundException e) {

// empty catch block





I don’t remember how to build or convert a JAVA file to a JAR file. Maybe there is an online compiler…

Some help is needed here.

There is no need to decompile, the source is freely available Openfire/src/plugins/emailOnAway at master · igniterealtime/Openfire · GitHub

One can use Ant to build it. I use Eclipse to build whole Openfire with all the plugins.

1 Like


I don’t mean to be rude nor ungrateful, please don’t get me wrong, but this is way too complicated to do a so simple task: to translate a string, which is expected to be treated as a variable, not as a literal inside a compiled file. I’ve been struggling with it for more than 4 hours - just to translate a sentence and didn’t accomplish it yet.

Aside this incovenient, the plugin works perfectly - so, thank you!

After 4 days trying to translate the sentence with no success, I’ve decided to remove the plugin. I tried to use Eclipse as mentioned, but everything is so “dark/blind” to understand how to create the new plugin that I finally gave up.

A pitty, it’s very useful but without translation it gets confusing for our users.

Working with Spark/Openfire source in Eclipse (GitHub)

After changing the needed source file one can run the Ant for plugins building (it is similar as with Spark). New plugin’s jar should be somewhere in the target folder then.

1 Like


Thanks for reply. It’s very nice your attempt to help, I really appreciate it, but I’m not a programmer, so all these tools and codes are strange to me. Tips on how to accomplish it won’t work for people like me, that just need a sentence translation (which should be simple). I am not trying to change the plugin behavior or it’s logical structure. It takes too much to get too few. There is a physical structure in the original plugin, which I can not reproduce using your tips.

So, if someone could be kind to show us, step by step how to do it, that would be perfect - or else, the plugin can not be used for users that don’t speak English. Again, a pitty, I like it and would love to use it.


I’m not a developer either. But as i work in IT, i was able to grasp the basics. Of course, this is not meant for simple users to alter the behavior, but this is rather easy to change and writing lengthy guide takes time. Having an option in the plugin to provide your own message would be more convenient, BUT this requires more coding and knowledge and there are no developers caring for this plugin to code that. So…

Out of the guide i provided you need only this (i default to 32-bit versions as this will work on any platform, I also assume you use Windows):

Prepare environment:

Download and install JDK Java SE Development Kit 8 - Downloads (press Accept license and select Windows x86 189.2 MB jdk-8u102-windows-i586.exe)

Download and unpack Eclipse in some folder Eclipse downloads - Select a mirror

run Eclipse

Setup Project in Eclipse with Git support:

File > Import > Git > Project from Git > Next (if there is no such menu, you will need to install EGit plugin for Eclipse, but i think it should already be included)

Clone URI > Next (Authentication not needed at this point) > Next

Select only “master” > Next

Select directory X:\SomeFolder\Openfire > Next

wait until cloned (it will take long)

Import as a general project > Next > Finish

right click imported project and Delete (do not select deleting files on disk)

File > New > Java Project

Project name: Openfire

Uncheck “use default location” and set directory to X:\SomeFolder\Openfire > Finish

Edit plugin:

In Eclipse expand Openfire folder and go to src/plugins/EmailOnAway/src/java -> com.tempstop - double click

go to lines 58-59 and change them to:

message.setBody("Your custom message when email is shown  (" + emailTo + ")."); } else { message.setBody("Your custom message when email is not shown."); }

Close and save the file. If you are going to use unicode characters, Eclipse will automatically change them to \u012e or similar. That’s ok. Leave it like that.

Build plugin:

Press Ant icon on the right (literally a little ant bug icon)

(little ant icon with a plus) Add buildfiles > select Openfire > build > build.xml

right click Ant script - Openfire XMPP Server > Run As > External Tools Configurations… > select Openfire build.xml > JRE tab > select Run in the same JRE as the workspace > Apply > Close (this could already be like that)

Press Run Target button to build a project (a green “play” button)

Wait until it shows BUILD SUCCESSFUL

Then go to X:\SomeFolder\Openfire\target\openfire\plugins and copy EmailOnAway.jar from there. Stop your Openfire. Delete old EmailOnAway.jar and its folder from your Openfire installation folder (Openfire/plugins/). Copy new jar file into Openfire/plugins and run your server. Check if it sends the altered message.