/** * 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(expected = IllegalArgumentException.class) public void setIllegalPriorityTest() { getNewPresence().setPriority(Integer.MIN_VALUE); }
@Test public void setPresencePriorityTest() throws IOException, SAXException { final int priority = 10; StringBuilder controlBuilder = new StringBuilder(); controlBuilder.append("<presence>") .append("<priority>") .append(priority) .append("</priority>") .append("</presence>"); String control = controlBuilder.toString(); Presence presence = getNewPresence(); presence.setPriority(priority); assertEquals(priority, presence.getPriority()); assertXMLEqual(control, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); }
case "priority": int priority = Integer.parseInt(parser.nextText()); presence.setPriority(priority); break; case "show":
Presence subscription = new Presence( Presence.Type.subscribe); subscription.setTo(CurrentUser+"@reza-hp"); subscription.setPriority(24); newp.setMode(Presence.Mode.available); connection.sendPacket(subscription);
// 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); }
/** * 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); }
try { int priority = Integer.parseInt(parser.nextText()); presence.setPriority(priority); presence.setPriority(0);
try { int priority = Integer.parseInt(parser.nextText()); presence.setPriority(priority); } catch (NumberFormatException nfe) { presence.setPriority(0);
try { int priority = Integer.parseInt(parser.nextText()); presence.setPriority(priority); presence.setPriority(0);
try { int priority = Integer.parseInt(parser.nextText()); presence.setPriority(priority); presence.setPriority(0);
presence.setFrom(userJID); presence.setStatus(""); presence.setPriority(30);
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; } }
presence.setPriority(getPriority()); Presence presence = StatusBar.copyPresence(oldPresence); presence.setStatus(getStatus()); presence.setPriority(getPriority());
case "priority": int priority = Integer.parseInt(parser.nextText()); presence.setPriority(priority); break; case "show":
@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()); } };