New Sparkplug Available! "SparkWords"

Hi Roberts,

please see http://www.jivesoftware.org/community/thread.jspa?threadID=17972 on how to install the plugins manually.

LG

Everyone-

Well, I rewrote SparkWords to detect presence changes. Harder than expected because Spark hasn’'t exposed the entire get roster option, so I had to sneak it through the Smack API.

Here’‘s my problem - anyone have any idea on how to tell when a user comes online? I can tell when they change presence, but I can’'t tell when they actually come online. Any advice?

Thanks,

Tim

Hi Tim,

Something like the following should work for you:

private void initContactHandlers() {

Iterator contactGroupsIter = SparkManager.getWorkspace()

.getContactList().getContactGroups().iterator();

while (contactGroupsIter.hasNext()) {

ContactGroup contactGroup = (ContactGroup) contactGroupsIter.next();

Iterator contactItemsIter = contactGroup.getContactItems()

.iterator();

while (contactItemsIter.hasNext()) {

ContactItem contactItem = (ContactItem) contactItemsIter.next();

contactItem.setHandler(new ContactItemPresenceHandler(

contactItem));

}

}

}

private class ContactItemPresenceHandler implements ContactItemHandler {

private ContactItem contact;

public ContactItemPresenceHandler(ContactItem contact) {

this.contact = contact;

}

public void handlePresence(Presence presence) {

if (presence.getMode() == Presence.Mode.AVAILABLE) {

JOptionPane.showMessageDialog(SparkManager.getMainWindow(),

contact.getName() + " just came online.",

“Presence Change”, JOptionPane.INFORMATION_MESSAGE);

}

}

public boolean handleDoubleClick() {

return false;

}

}

/code

Hope that helps,

Ryan

Ryan,

That code isn’'t too dissimilar from what I ended up doing.

The problem, however, is that I know when they are available but I don’'t know necessarily when they came online. If they are simply away, when they come back, this alert will pop up, also.

Any ideas? Do I have to keep track of every single contact’‘s presence? What’‘s their status in Spark when they aren’'t online? Mode.what?

Thanks,

Tim

Message was edited by: tim.chandler

Hi Tim,

Do I have to keep track of every single contact’'s presence?

Yes and no. The best way seems to add a ContactItemHandler to each contact, that’'s why I iterate through each group and then each contact in the group.

What’‘s their status in Spark when they aren’'t online? Mode.what?

It’‘s a little bit different when they aren’'t online, the Presence object that is passed into the handlePresence() is null.

Hope that helps,

Ryan

Great tool, but I have a question, can you disable the toaster popup for when Spark has focus? It’‘s a little odd to be in the middle of a chat and the popup comes up with info on my existing chat… I think it should only popup for non-focused chats (if you have multiples open), or any chat if Spark itself doesn’'t have focus… Otherwise, love it!!

Hello,

I am very impressed with this plugin!

What I would like to see:

  1. The possibility to show the avatar of the person who sent the message (like in Google Talk)

  2. The possibility to change the color of the background

  3. The possibility to hide the resource (with Google: Talk.v2222828282s2322, it’'s too long!)

For the background, it would be cool to change the color depending of some keyword int the message… for example, if the message contains URGENT, then the background is red…

All this should be configurable via the preferences

What do you think of that?

Message was edited by: mannings

Mannings,

I think its a great idea. However, I am stuck in finals at school right now and will be for a couple of weeks. I have a whole ton of features I want to implement after that. So, look for an updated version in around three or so weeks.

Thanks,

Tim

Thank you!

I will take a look at futures updates. This plugin is very useful to me.

Hello Tim,

First thanks for this plgin i really like it…

also may i add something about the presence issue you are having…

sorry i’'m not a programmer so i may be totally wrong here…

  1. Why not ask Spark IM to notify all people who’‘s in the contact list that he’'s online now?

Can this be done?

One interesting feature also would be a timer configuration… i.e be able to tell whether i want the popup to dissapear after x seconds or not at all

  1. pop-up dissapear after x seconds

  2. pop-up stays untill you click on it

  3. pop-up stays untill you reply to the received message

thanks,