ROAR pop up doesn't show when broadcasting the message?

Hi,

I’m configuring Spark to be used in our company. I noticed that ROAR pop up doesn’t show up when you broadcast the message to all users? It only shows when you message individual users directly. Is this normal behaviour or is there an issue?

Thanks for the advice.

Regards,

I’ve noticed and filed this as SPARK-1534 a while ago. sadly the developer who has provided this plugin doesn’t work on Spark anymore, so i’m not sure when it will be fixed.

Solution for this bug (you need to edit Spark sources):

In \src\java\org\jivesoftware\sparkimpl\plugin\alerts\BroadcastPlugin.java you need to edit:

private void userToUserBroadcast(Message message, Type type, String from)

(add this between lines toaster.showToaster(message.getBody()); and chatRoom.addMessageListener(new MessageListener())

for (PublicPlugin publicPlugin : PluginManager.getInstance().getPublicPlugins()) {

  • if (“Roar!!!”.equals(publicPlugin.getName())) { *

  •  SparkManager.getChatManager().fireGlobalMessageReceievedListeners(chatRoom, message);*
    
  •  DelayInformation inf = (DelayInformation)message.getExtension("x", "jabber:x:delay");*
    
  •  if (inf == null) {*
    
  •     SoundPreference soundPreference = (SoundPreference)SparkManager.getPreferenceManager().getPreference(new SoundPreference().getNamespace());*
    
  •     SoundPreferences preferences = soundPreference.getPreferences();*
    
  •     if (preferences.isPlayIncomingSound()) {*
    
  •        File incomingFile = new File(preferences.getIncomingSound());*
    
  •        SparkManager.getSoundManager().playClip(incomingFile);*
    
  •     }*
    
  •  }                           *
    
  • }*

}

Spark is not firing *fireGlobalMessageReceievedListeners *when new broadcast message is received, my code is doing this:

  1. check if Roar is installed
  2. fire listener (Roar will notice this and shows popup windows)
  3. play incomming message sound (if you have enabled it)

This is solution which I am using in our branded Spark. Another Roar bug is showing many new popups when you enter old conference room (with old messages) under certain circumstances. I can provide solution for this too if you are interested.

Yes, it would be nice to have those fixes. Can you please attach them as a diff format patches here?

Thanks for reply!

I’m using Windows systems, can you advise where I can find broadcast.plugin on Windows? I tried to find it but failed. Or is it named differently under windows systems?

Regards,.

Why do you want to find it? Do you want to edit it and compile on your own? Tomas was saying about the source code files, not the regular files in Spark installation. One has to edit the source file and the compile the new binaries and libraries (the ones used in Spark installation).

Hi,

Sorry, I understood that this part of code could have been entered into the existing installation files. Would the update be available soon to fix this problem?

Kind regards,

This depends on when Tomas will attach his patches here and when some developer will have time to review and apply them.

Sorry for my late answer. Here are my diff files:

BroadcastPlugin.patch

  • \src\java\org\jivesoftware\sparkimpl\plugin\alerts
  • after this patch Roar should show popups for broadcast messages
  • sound for new brodacast message will be played (if you have enabled sound for incoming messages)

Next patch is for Roar plugin to avoid showing many popups when you join old groupchat room (groupchat with already written messages). I am not sure if this patch is correct because i commented many lines in original source code and made old groupchat check much more simpler. So anyone experienced should check these changes, but for me it works fine.

RoarMessageListener.patch

  • \src\plugins\roar\src\java\org\jivesoftware\spark\roar
  • changed Roar listener mechanic how to detect old groupchats

Last two changes are only small improvements. Roar popup will change to Broadcast - (sender name) when you receive broadcast message.

BottomRight.patch

TopRight.patch

  • \src\plugins\roar\src\java\org\jivesoftware\spark\roar\displaytype

Hope this helps somebody, Tomas
BroadcastPlugin.patch.zip (684 Bytes)
RoarMessageListener.patch.zip (1585 Bytes)
BottomRight.patch.zip (428 Bytes)
TopRight.patch.zip (421 Bytes)

Hey. Thanks!

I have uploaded your patch to SPARK-1534 (closed SPARK-1467 as it was for sound in broadcasts) and filed SPARK-1565 and SPARK-1566 for your other patches. Will try to test them myself tomorrow and then will assign to some fairly active developer to commit to the trunk.

Hm. It looks like the format in these patches is a bit different from usual and i can’t apply them in my NetBeans setup.

working format for me is something like that:

Index: src/java/org/jivesoftware/sparkimpl/plugin/transcripts/ChatTranscriptPlugin.jav a

===================================================================

— src/java/org/jivesoftware/sparkimpl/plugin/transcripts/ChatTranscriptPlugin.jav a (revision 6854)

+++ src/java/org/jivesoftware/sparkimpl/plugin/transcripts/ChatTranscriptPlugin.jav a (working copy)

@@ -56,6 +56,7 @@

import javax.swing.UIManager;

import javax.swing.text.html.HTMLEditorKit;

+import org.jaxen.function.RoundFunction;

import org.jdesktop.swingx.calendar.DateUtils;

import org.jivesoftware.MainWindowListener;

import org.jivesoftware.resource.Res;

@@ -203,7 +204,7 @@

}

final String jid = room.getRoomname();

File transcriptFile = ChatTranscripts.getTranscriptFile(jid);

if (!transcriptFile.exists()) {

return;

@@ -336,35 +337,77 @@

builder.append("

");

final TimerTask transcriptTask = new TimerTask() {

  •                public void run() {
    
  •                    ChatTranscript transcript = (ChatTranscript)get();
    

Hello,

I made small changes to BroadcastPlugin.java patch (Roar popups and sound for broadcast message).

And of course i converted my patch files for you. I hope they will be ok this time.
BroadcastPlugin.patch.zip (1263 Bytes)
RoarMessageListener.patch.zip (2042 Bytes)
BottomRight.patch.zip (754 Bytes)
TopRight.patch.zip (737 Bytes)

Ugh, the problem was not with the format i think, but that full path to java file was not in the patch I’m applying patches to the root of the source, so it couldn’t find a file to patch. Not a problem, but i have updated all your patches with the full path, just in case.

BroadcastPlugin patch tested. Works fine. Shows popups and plays sound for broadcast message.

RoarMessageListener - interesting, that this only happens when JTattoo skins are in use, and Substance skin doesn’t show Roar popups when joining a room with history. Done minimal testing with both skins and looks like issue is fixed. Though in both cases (with patch or without) Roar doesn’t show popups for new normal messages in the room… Probably another issue. Or maybe this is by design as it can be a non stopping flood of popups if a room is very active or if you have many rooms opened…

Last one doesn’t work for me. Popup still shows only the name of the sender of a broadcast message.

Will update tickets with newer patch versiond and assign first two to Mircea. He was active lately, so maybe he will apply them quick enough.

Okey, next time i will try to do it properly.

RoarMessageListener - I am using system skin in Spark (it shows like Windows in options) and Roar is working properly for messages in group chat rooms. So this is not by design and i don’t think i made any other changes in Roar source code. Can you try it with default system skin too?

BottomRight and TopRight patches - This is weird, i don’t see any reason why it should not work for you. This is only simple check if message is from broadcast and then adding some new text to popup. Can you debug Spark client and check why my code fails on your setup?

Thanks, Tomas

Weird. It is indeed is only working when Windows skin is selected. But the default for new installations is JTattoo Luna skin. Filed as SPARK-1568

How should i debug Spark to see where it fails? Btw, i’m sending broadcast from another Spark via Send broadcast menu, sending simple message to all Online users.

With Spark debugger i get this packet:

fgggggggggggggggggggggg

bp2gy1

It comes as a broadcast message (“i” icon in the tab and prefix Broadcast before the message in the chat window).

Nice thing this Smack Debug Window Use it first time, really helpful.

Important part is not message xml (i receive messages in same format as you) but message type. You must receive messages with type normal (you can see this in Smack Debug Window) and then should my patch work:

if ((broadcast || message.getType() == Message.Type.normal || message.getType() == Message.Type.headline) && message.getBody() != null)

It should meet condition and add text to popup.

Tomorrow i will play more with Spark skins and maybe i will figure something about not working Roar with them.

Hmm, i tried to change my skins to JTattoo and Substance. For both Roar shows new messages in group chats. It seems we need someone else to test it and post results.

About broadcast popup - I think it must be something else on your side, how did you apply my patches? You mentioned something about Netbeans. I am using Netbeans too and for plugins there is one catch. If you made some change in source codes of plugin you need to first rebuild plugin itself (this will copy new jar file into Spark build folder). After this you can build whole Spark and changes should be visible. It takes me some time until i figured this out

Tomas Hruska wrote:

Hmm, i tried to change my skins to JTattoo and Substance. For both Roar shows new messages in group chats. It seems we need someone else to test it and post results.

My bad. I was testing with the virtual machine and covering the chat window with virtual machine window while sending a message, but the chat window itself stayed active, so no popups were shown. After i minimized the chat window and then sent the message, popup showed up

you need to first rebuild plugin itself

Right! I remember now that i had to do this when i was testing changes for another plugin. I have rebuilt Roar and now your changes work. Well, it is “(sender’s name) - Broadcast”, but i think the order doesn’t matter.

Great, all 4 patches should be OK.

In BottomRight.patch (TopRight.patch) change this line

nickname = nickname + " - " + Res.getString(“broadcast”);

to

nickname = Res.getString(“broadcast”) + " - " + nickname;

and it will be switched.

Spark-1568: Option to turn off popups for group chat only as it can be overwhelming in a crowdy and active room (many popups).

This should be easy task, i will look at it next week.

Tomas, your patches for showing popup and playing sound and adding name to the popup are now applied to the trunk. It looks like in the broadcastplugin patch you have also fixed another ticket of mine SPARK-1528. One can see these changes in the latest build (657):

http://www.igniterealtime.org/downloads/nightly_spark.jsp