public JabberDataBlock constructVCard() { JabberDataBlock vcardIq = new Iq(null, Iq.TYPE_SET, "vcard-set"); JabberDataBlock vcardTemp = vcardIq.addChildNs("vCard", "vcard-temp"); int itemsCount = getCount(); for (int i = 0; i < itemsCount; i++) { String field = getVCardData(i); if (field == null) continue; String f1 = (String) VCard.vCardFields.elementAt(i); String f2 = (String) VCard.vCardFields2.elementAt(i); JabberDataBlock subLevel = vcardTemp; if (f2 != null) { subLevel = vcardTemp.getChildBlock(f2); if (subLevel == null) subLevel = vcardTemp.addChild(f2, null); } subLevel.addChild(f1, field); } if (photo != null) { String mime = getPhotoMIMEType(); if (mime != null) { JabberDataBlock ph = vcardTemp.addChild("PHOTO", null); ph.addChild("BINVAL", strconv.toBase64(photo, -1)); ph.addChild("TYPE", mime); } } // System.out.println(vcard.toString()); return vcardIq; }
private void setMucMod() { JabberDataBlock iq = new Iq(victim.jid.getBareJid(), Iq.TYPE_SET, "itemmuc"); JabberDataBlock query = iq.addChildNs("query", "http://jabber.org/protocol/muc#admin"); // TODO: separate usecases to muc#owner, muc#admin and muc#moderator JabberDataBlock item = new JabberDataBlock("item", null, null); query.addChild(item); try { String rzn = reason.getValue(); String Nick = ""; if (rzn.charAt(0) == '!') { rzn = rzn.substring(1); } else { Nick = (myNick == null) ? myNick : myNick + ": "; } if (rzn.length() != 0 && myNick != null) { item.addChild("reason", Nick + rzn); } else { item.addChild("reason", Nick); } } catch (Exception e) { } switch (action) { case KICK: item.setAttribute("role", "none"); item.setAttribute("nick", victim.getNick()); break; case OUTCAST: item.setAttribute("affiliation", "outcast"); item.setAttribute("jid", victim.realJid); break; case PARTICIPANT: item.setAttribute("role", "participant"); item.setAttribute("nick", victim.getNick()); break; case VISITOR: item.setAttribute("role", "visitor"); item.setAttribute("nick", victim.getNick()); break; case MODERATOR: item.setAttribute("role", "moderator"); item.setAttribute("nick", victim.getNick()); break; case MEMBER: item.setAttribute("affiliation", "member"); item.setAttribute("jid", victim.realJid); break; case NONE: item.setAttribute("affiliation", "none"); item.setAttribute("jid", victim.realJid); break; case ADMIN: item.setAttribute("affiliation", "admin"); item.setAttribute("jid", victim.realJid); break; case OWNER: item.setAttribute("affiliation", "owner"); item.setAttribute("jid", victim.realJid); } StaticData.getInstance().roster.theStream.send(iq); }
public void XDataFormSubmit(JabberDataBlock form) { JabberDataBlock reply = new Iq(from, Iq.TYPE_SET, id); reply.addChildNs("captcha", "urn:xmpp:captcha").addChild(form); midlet.BombusQD.sd.roster.theStream.send(reply); }
public static JabberDataBlock getQueryVCard(String to, String id) { JabberDataBlock req = new Iq(to, Iq.TYPE_GET, id); req.addChildNs("vCard", "vcard-temp"); return req; }