/** * 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); }
@Test public void setPresenceStatusTest() throws IOException, SAXException { final String status = "This is a test of the emergency broadcast system."; StringBuilder controlBuilder = new StringBuilder(); controlBuilder.append("<presence>") .append("<status>") .append(status) .append("</status>") .append("</presence>"); String control = controlBuilder.toString(); Presence presence = getNewPresence(); presence.setStatus(status); assertEquals(status, presence.getStatus()); assertXMLEqual(control, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); }
/** * 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); }
switch (elementName) { case "status": presence.setStatus(parser.nextText()); break; case "priority":
presence.setStatus(status);
presence.setStatus(status);
connection.setStatus(true,"ONLINE"); public void setStatus(boolean available, String status) throws XMPPException { Presence.Type type = available? Type.available: Type.unavailable; Presence presence = new Presence(type); presence.setStatus(status); connection.sendPacket(presence); }
Presence presence = new Presence(Presence.Type.subscribe); presence.setStatus("Online"); xmpp.sendPacket(presence);
if (isConnectionAlive() || reConnectAndAuth(orgContext)) { Presence presence = new Presence(org.jivesoftware.smack.packet.Presence.Type.unavailable); presence.setStatus(connection.getUser() + status); pm = null; try { connection.disconnect(presence); } catch (Exception exception) { exception.printStackTrace(); connection.disconnect(); } Log.w("LogOut", "LogOut"); }
presence.setStatus(status); connection.sendPacket(presence);
// 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);
/** * Declare the status on the XMPP Chat * * @param available * @param status */ public void setStatus(boolean available, String status) throws Exception { Presence.Type type = available ? Type.available : Type.unavailable; Presence presence = new Presence(type); presence.setStatus(status); connection.sendPacket(presence); }
if(selectedRoster != null) { Presence presence = new Presence(Presence.Type.unsubscribe); presence.setTo(selectedRoster.getUser()); presence.setStatus("Offline"); presence.setShow("unavailable"); ConnectionController.GetInstance(this).getXMPPConnection().sendPacket(presence); try { roster.removeEntry(selectedRoster); } catch (XMPPException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
/** * 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); }
/** * 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 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 void actionPerformed(ActionEvent e) { StatusBar statusBar = SparkManager .getWorkspace().getStatusBar(); Presence oldPresence = statusItem.getPresence(); Presence presence = StatusBar .copyPresence(oldPresence); presence.setStatus(customItem.getStatus()); presence.setPriority(customItem.getPriority()); SparkManager.getSessionManager() .changePresence(presence); statusBar.setStatus(statusItem.getName() + " - " + customItem.getStatus()); } };