/** * Return the IdleElement from a presence. * Returns null, if no IdleElement found. * * @param presence presence * @return idleElement from presence or null */ public static IdleElement fromPresence(Presence presence) { return presence.getExtension(ELEMENT, NAMESPACE); }
AgentStatus agentStatus = presence.getExtension( AgentStatus.ELEMENT_NAME, AgentStatus.NAMESPACE); if (agentStatus == null) {
Occupant(Presence presence) { MUCUser mucUser = (MUCUser) presence.getExtension("x", "http://jabber.org/protocol/muc#user"); MUCItem item = mucUser.getItem(); this.jid = item.getJid(); this.affiliation = item.getAffiliation(); this.role = item.getRole(); // Get the nickname from the FROM attribute of the presence EntityFullJid from = presence.getFrom().asEntityFullJidIfPossible(); if (from == null) { LOGGER.warning("Occupant presence without resource: " + presence.getFrom()); this.nick = null; } else { this.nick = from.getResourcepart(); } }
QueueOverview queueOverview = presence.getExtension(QueueOverview.ELEMENT_NAME, QueueOverview.NAMESPACE); if (queueOverview != null) { if (queueOverview.getStatus() == null) { StandardExtensionElement notifyAgents = presence.getExtension("notify-agents", "http://jabber.org/protocol/workgroup"); if (notifyAgents != null) { int currentChats = Integer.parseInt(notifyAgents.getFirstElement("current-chats", "http://jabber.org/protocol/workgroup").getText());
/** * Get the {@link AvatarIdPacketExtension} inside a {@link Presence} or null * when it's not inside * * @param p the presence * @return the {@link AvatarIdPacketExtension} or null */ private AvatarIdPacketExtension getAvatarIdExtensionOrNull(Presence p) { return p.getExtension(AvatarIdPacketExtension.ELEMENT_NAME, AvatarIdPacketExtension.NAME_SPACE); }
private TranscriptionRequestExtension getTranscriptionRequestExtensionOrNull(Presence p) { return p.getExtension(TranscriptionRequestExtension.ELEMENT_NAME, TranscriptionRequestExtension.NAMESPACE); }
/** * {@inheritDoc} */ @Override public boolean containsPresenceExtension(String elementName, String namespace) { return lastPresenceSent != null && lastPresenceSent.getExtension(elementName, namespace) != null; }
/** * Get the {@link IdentityPacketExtension} inside a {@link Presence}, * or null when it's not inside * * @param p the presence * @return the {@link IdentityPacketExtension} or null */ private IdentityPacketExtension getIdentityExtensionOrNull(Presence p) { return p.getExtension(IdentityPacketExtension.ELEMENT_NAME, IdentityPacketExtension.NAME_SPACE); }
/** * Returns the {@link TranscriptionStatusExtension} if any from * the given {@link Presence}. * * @param p the given {@link Presence} to check * @return Returns the {@link TranscriptionStatusExtension} if any. */ private TranscriptionStatusExtension getTranscriptionStatus(Presence p) { return p.getExtension( TranscriptionStatusExtension.ELEMENT_NAME, TranscriptionStatusExtension.NAMESPACE ); }
/** * Returns the MUCUser packet extension included in the packet or * <tt>null</tt> if none. * * @param packet the packet that may include the MUCUser extension. * @return the MUCUser found in the packet. */ private MUCUser getMUCUserExtension(Presence packet) { if (packet != null) { // Get the MUC User extension return (MUCUser) packet.getExtension( "x", "http://jabber.org/protocol/muc#user"); } return null; }
public void interceptPacket(Packet packet) { Presence presence = (Presence) packet; // Check if user is joining a room if (Presence.Type.available == presence.getType() && presence.getExtension("x", "http://jabber.org/protocol/muc") != null) { // Add extension that indicates that user wants to be a deaf occupant packet.addExtension(new DeafExtension()); } }
public void interceptPacket(Packet packet) { Presence presence = (Presence) packet; // Check if user is joining a room if (Presence.Type.available == presence.getType() && presence.getExtension("x", "http://jabber.org/protocol/muc") != null) { // Add extension that indicates that user wants to be a deaf occupant packet.addExtension(new DeafExtension()); } }
public void interceptPacket(Packet packet) { Presence presence = (Presence) packet; // Check if user is joining a room if (Presence.Type.available == presence.getType() && presence.getExtension("x", "http://jabber.org/protocol/muc") != null) { // Add extension that indicates that user wants to be a deaf occupant packet.addExtension(new DeafExtension()); } }
public void interceptPacket(Packet packet) { Presence presence = (Presence) packet; // Check if user is joining a room if (Presence.Type.AVAILABLE == presence.getType() && presence.getExtension("x", "http://jabber.org/protocol/muc") != null) { // Add extension that indicates that user wants to be a deaf occupant packet.addExtension(new DeafExtension()); } }
public void changeAvailability(final Presence presence) { // SPARK-1524: if we were reconnected because of the error // then we get presence with the mode == null. if (presence.getMode() == null) return; if ((presence.getMode() == currentPresence.getMode()) && (presence.getType() == currentPresence.getType()) && (presence.getStatus().equals(currentPresence.getStatus()))) { ExtensionElement pe = presence.getExtension("x", "vcard-temp:x:update"); if (pe != null) { // Update VCard loadVCard(); } return; } currentPresence = presence; SwingUtilities.invokeLater(changePresenceRunnable); }
Occupant(Presence presence) { super(); MUCUser mucUser = (MUCUser) presence.getExtension("x", "http://jabber.org/protocol/muc#user"); MUCUser.Item item = mucUser.getItem(); this.jid = item.getJid(); this.affiliation = item.getAffiliation(); this.role = item.getRole(); // Get the nickname from the FROM attribute of the presence this.nick = StringUtils.parseResource(presence.getFrom()); }
Occupant(Presence presence) { super(); MUCUser mucUser = (MUCUser) presence.getExtension("x", "http://jabber.org/protocol/muc#user"); MUCUser.Item item = mucUser.getItem(); this.jid = item.getJid(); this.affiliation = item.getAffiliation(); this.role = item.getRole(); // Get the nickname from the FROM attribute of the presence this.nick = StringUtils.parseResource(presence.getFrom()); }
Occupant(Presence presence) { super(); MUCUser mucUser = (MUCUser) presence.getExtension("x", "http://jabber.org/protocol/muc#user"); MUCUser.Item item = mucUser.getItem(); this.jid = item.getJid(); this.affiliation = item.getAffiliation(); this.role = item.getRole(); // Get the nickname from the FROM attribute of the presence this.nick = StringUtils.parseResource(presence.getFrom()); }
Occupant(Presence presence) { super(); MUCUser mucUser = (MUCUser) presence.getExtension("x", "http://jabber.org/protocol/muc#user"); MUCUser.Item item = mucUser.getItem(); this.jid = item.getJid(); this.affiliation = item.getAffiliation(); this.role = item.getRole(); // Get the nickname from the FROM attribute of the presence this.nick = StringUtils.parseResource(presence.getFrom()); }
/** * Sets the current presence on this contact item. * * @param presence the presence. */ public void setPresence(Presence presence) { this.presence = presence; final VCardUpdateExtension extension = presence.getExtension("x", "vcard-temp:x:update"); // Handle vCard update packet. if (extension != null) { String hash = extension.getPhotoHash(); if (hash != null) { this.hash = hash; if (!hashExists(hash)) { updateAvatar(); updateAvatarInSideIcon(); } } } updatePresenceIcon(presence); }