Send Message from Admin by Plugin

Hi,

I am new in Wildfire and tried to write and setup a new plugin in admin page to let admin send messages to all or selected groups.

Our system works base on Active Directory users, so admin selects users from these groups.

My plugin starts and by system.print, I can check and see that user group work (shows me some users like username@server) and then make message to send to them by sessionManager.broadcast(newMessage);

, but nothing receive in client parts.

Would you please let me know the steps to write codes for only send message from Admin. Should I register a component to be able to send message? Do you know any tutorial documents for these steps? I read wildfire documents some times and checked Java.Doc for wildfire APIs as well.

Some parts of my plugin codes are as bellow:

Message message = new Message();

message.setBody(theBody);

message.setSubject(“A message from admin”);

for (JID userJID : gg.getMembers())

{ Message newMessage = message.createCopy(); newMessage.setTo(userJID); try { sessionManager.broadcast(newMessage); }

catch (Exception e) { componentManager.getLog().error(e); }

Thanks

Hi,

did you take a look at the broadcast plugin (src code is in wildfire_src)? It works fine and you may just need to create a JSP for it if you want to use it within the admin console.

LG

Thanks. It works.

But it sends only to connected users and not logoffed ones.

I send to all@server or group@server or username@server. Do you know how can I send to all, group, user specially logged off users. Then when they logged in, they can see the message as well.

Hi,

you need to modify the source code yourself to broadcast to online and offline users.

It may be nice if a system property would be available within this plugin to control this, I could create an issue for this, but resolving the issue will usually take some months. So it may help if you change the code and send a diff to Gato how may check-in the change into SVN.

LG

Sorry, but I did’'nt get it.

From documents, I used

componentManager.sendPacket(this, newMessage);

to send message to a group and online users get it. Documents say that the off line ones will get it when they became online. But nothing happens.

Would you please say me in more details.

Thanks