(final String moodText, final String moodName)
| 63 | } |
| 64 | |
| 65 | private void publishTune(final String moodText, final String moodName) { |
| 66 | String sid="publish-mood"; |
| 67 | JabberDataBlock setMood=new Iq(null, Iq.TYPE_SET, sid); |
| 68 | JabberDataBlock action=setMood.addChildNs("pubsub", "http://jabber.org/protocol/pubsub") .addChild( (moodText!=null)?"publish":"retract", null); |
| 69 | action.setAttribute("node", "http://jabber.org/protocol/mood"); |
| 70 | JabberDataBlock item=action.addChild("item", null); |
| 71 | item.setAttribute("id", Moods.getInstance().myMoodId); |
| 72 | |
| 73 | if (moodText!=null) { |
| 74 | JabberDataBlock mood=item.addChildNs("mood", "http://jabber.org/protocol/mood"); |
| 75 | |
| 76 | mood.addChild(moodName, null); |
| 77 | mood.addChild("text",moodText); |
| 78 | } else { |
| 79 | item.addChild("retract", null); |
| 80 | action.setAttribute("notify","1"); |
| 81 | } |
| 82 | try { |
| 83 | //todo: refactor theStream call; send notification to JabberBlockListener if stream was terminated |
| 84 | StaticData.getInstance().getTheStream().addBlockListener(new PepPublishResult( sid)); |
| 85 | StaticData.getInstance().getTheStream().send(setMood); |
| 86 | } catch (Exception e) { |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | //#endif |
no test coverage detected