(int activity, String text)
| 62 | } |
| 63 | |
| 64 | public void publish(int activity, String text) { |
| 65 | String sid="publish-activity"; |
| 66 | JabberDataBlock setActivity=new Iq(null, Iq.TYPE_SET, sid); |
| 67 | JabberDataBlock action=setActivity.addChildNs("pubsub", "http://jabber.org/protocol/pubsub") .addChild("publish", null); |
| 68 | action.setAttribute("node", "http://jabber.org/protocol/activity"); |
| 69 | JabberDataBlock item=action.addChild("item", null); |
| 70 | //item.setAttribute("id", Activities.getInstance().myActId); |
| 71 | JabberDataBlock act=item.addChildNs("activity", "http://jabber.org/protocol/activity"); |
| 72 | if (activity > 0) { |
| 73 | String[] actName = Activities.getInstance().getActName(activity); |
| 74 | JabberDataBlock gen = act.addChild(actName[0], null); |
| 75 | gen.addChild(actName[1], null); |
| 76 | act.addChild("text", text); |
| 77 | } |
| 78 | |
| 79 | try { |
| 80 | //todo: refactor theStream call; send notification to JabberBlockListener if stream was terminated |
| 81 | sd.getTheStream().addBlockListener(new PepPublishResult(sid)); |
| 82 | sd.getTheStream().send(setActivity); |
| 83 | } catch (Exception e) { |
| 84 | if (StaticData.Debug) { |
| 85 | e.printStackTrace(); |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | //#endif |
no test coverage detected