MCPcopy Create free account
hub / github.com/BombusMod/BombusMod / publishTune

Method publishTune

src/main/java/PEP/MoodList.java:65–88  ·  view source on GitHub ↗
(final String moodText, final String moodName)

Source from the content-addressed store, hash-verified

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

Callers 1

OkNotifyMethod · 0.95

Calls 8

addChildMethod · 0.95
addChildNsMethod · 0.95
setAttributeMethod · 0.95
getInstanceMethod · 0.95
getInstanceMethod · 0.95
getTheStreamMethod · 0.80
addBlockListenerMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected