/** * Creates a new presence update with a specified status, priority, and mode. * * @param type the type. * @param status a text message describing the presence update. * @param priority the priority of this presence update. * @param mode the mode type for this presence update. */ public Presence(Type type, String status, int priority, Mode mode) { // Ensure that the stanza ID is set by calling super(). super(); setType(type); setStatus(status); setPriority(priority); setMode(mode); }
/** * Changes the occupant's availability status within the room. The presence type * will remain available but with a new status that describes the presence update and * a new presence mode (e.g. Extended away). * * @param status a text message describing the presence update. * @param mode the mode type for the presence update. * @throws NotConnectedException * @throws InterruptedException * @throws MucNotJoinedException */ public void changeAvailabilityStatus(String status, Presence.Mode mode) throws NotConnectedException, InterruptedException, MucNotJoinedException { final EntityFullJid myRoomJid = this.myRoomJid; if (myRoomJid == null) { throw new MucNotJoinedException(this); } // Check that we already have joined the room before attempting to change the // availability status. if (!joined) { throw new MucNotJoinedException(this); } // We change the availability status by sending a presence packet to the room with the // new presence status and mode Presence joinPresence = new Presence(Presence.Type.available); joinPresence.setStatus(status); joinPresence.setMode(mode); joinPresence.setTo(myRoomJid); // Send join packet. connection.sendStanza(joinPresence); }
presenceModeSet.setMode(mode2); assertEquals(mode2, presenceModeSet.getMode()); assertXMLEqual(control, presenceModeSet.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
String modeText = parser.nextText(); if (StringUtils.isNotEmpty(modeText)) { presence.setMode(Presence.Mode.fromString(modeText)); } else {
presence.setMode(presenceMode); presence.setTo(this.getWorkgroupJID());
presence.setMode(presenceMode); presence.setTo(this.getWorkgroupJID());
// Create the presence object with default availability Presence presence = new Presence(Presence.Type.available); // Set the status message presence.setStatus("Lame status is lame"); // Set the highest priority presence.setPriority(24); // Set available presence mode presence.setMode(Presence.Mode.available); // Send the presence packet through the connection connection.sendPacket(presence);
Presence presence = new Presence(Presence.Type.available); presence.setStatus("Online, Programmatically!"); presence.setPriority(24); presence.setMode(Presence.Mode.available); roster = Roster.getInstanceFor(connection);
/** * Creates a new presence update with a specified status, priority, and mode. * * @param type the type. * @param status a text message describing the presence update. * @param priority the priority of this presence update. * @param mode the mode type for this presence update. */ public Presence(Type type, String status, int priority, Mode mode) { setType(type); setStatus(status); setPriority(priority); setMode(mode); }
/** * Creates a new presence update with a specified status, priority, and mode. * * @param type the type. * @param status a text message describing the presence update. * @param priority the priority of this presence update. * @param mode the mode type for this presence update. */ public Presence(Type type, String status, int priority, Mode mode) { setType(type); setStatus(status); setPriority(priority); setMode(mode); }
/** * Creates a new presence update with a specified status, priority, and mode. * * @param type the type. * @param status a text message describing the presence update. * @param priority the priority of this presence update. * @param mode the mode type for this presence update. */ public Presence(Type type, String status, int priority, Mode mode) { setType(type); setStatus(status); setPriority(priority); setMode(mode); }
joinPresence.setMode(mode); joinPresence.setTo(room + "/" + nickname);
/** * Creates a new presence update with a specified status, priority, and mode. * * @param type the type. * @param status a text message describing the presence update. * @param priority the priority of this presence update. * @param mode the mode type for this presence update. */ public Presence(Type type, String status, int priority, Mode mode) { // Ensure that the stanza ID is set by calling super(). super(); setType(type); setStatus(status); setPriority(priority); setMode(mode); }
public XMPPConnection login() throws XMPPException { ConnectionConfiguration config = new ConnectionConfiguration("talk.google.com",5222,"gmail.com"); config.setSecurityMode(SecurityMode.required); config.setTruststoreType("BKS"); config.setTruststorePath("/system/etc/security/cacerts.bks"); XMPPConnection connection = new XMPPConnection(config); connection.connect(); connection.login(username, password); Presence presence = new Presence(Presence.Type.available); presence.setMode(Presence.Mode.available); connection.sendPacket(presence); try { Thread.sleep(3000); } catch (Exception ex) { ex.printStackTrace(); } return connection; }
joinPresence.setMode(mode); joinPresence.setTo(room + "/" + nickname);
joinPresence.setMode(mode); joinPresence.setTo(room + "/" + nickname);
joinPresence.setMode(mode); joinPresence.setTo(room + "/" + nickname);
public static Presence copy(Presence presence) { if (presence == null) return null; Presence copy = new Presence(presence.getType()); copy.setMode(presence.getMode()); copy.setStatus(presence.getStatus()); copy.setPriority(presence.getPriority()); return copy; } }
@Override public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception { Presence.Type typeVal = Presence.Type.valueOf(sampler.getPropertyAsString(TYPE, Presence.Type.available.toString())); Presence.Mode modeVal = Presence.Mode.valueOf(sampler.getPropertyAsString(MODE, Presence.Mode.available.toString())); Presence presence = new Presence(typeVal); presence.setMode(modeVal); String to = sampler.getPropertyAsString(RECIPIENT); if (!to.isEmpty()) { presence.setTo(to); } String text = sampler.getPropertyAsString(STATUS_TEXT); if (!text.isEmpty()) { presence.setStatus(text); } sampler.getXMPPConnection().sendPacket(presence); res.setSamplerData(presence.toXML().toString()); return res; }