Refine search
public static String randomId() { return StringUtils.randomString(24); } }
public StableAndUniqueIdElement(String id) { if (StringUtils.isNullOrEmpty(id)) { throw new IllegalArgumentException("Argument 'id' cannot be null or empty."); } this.id = id; } }
public String getRedirectURL() { if (!StringUtils.isNotEmpty(redirectURL)) { return ""; } return redirectURL; }
type = Presence.Type.fromString(typeString); Presence presence = new Presence(type); presence.setTo(ParserUtils.getJidAttribute(parser, "to")); presence.setFrom(ParserUtils.getJidAttribute(parser, "from")); presence.setStanzaId(parser.getAttributeValue("", "id")); case "show": String modeText = parser.nextText(); if (StringUtils.isNotEmpty(modeText)) { presence.setMode(Presence.Mode.fromString(modeText)); } else {
public void processPacket(Packet packet) { if(packet instanceof Presence){ Presence presence = (Presence)packet; if(entityJID.equals(presence.getFrom()) && roster.contains(presence.getFrom()) && presence.getType().equals(Presence.Type.subscribe)){ Presence response = new Presence(Presence.Type.subscribed); response.setTo(presence.getFrom()); response.setFrom(StringUtils.parseBareAddress(connection.getUser())); connection.sendPacket(response); } } } }
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()); }
public void run() { statusLine.setForeground(Color.black); statusLine.setText("<html><b>" + StringUtils.parseResource(presence.getFrom()) + "</b> is now " + presence.getType() + "</html>"); //NOI18N //fadein.start(); new Fader(statusLine).start(); } });
public static boolean isInvisible(Presence presence) { return presence != null && presence.getType() == Presence.Type.unavailable && (Res.getString("status.invisible").equalsIgnoreCase(presence.getStatus()) || isNullOrEmpty(presence.getStatus())) && Presence.Mode.available == presence.getMode(); }
public void userHasLogged(String user) { boolean isAnonymous = "".equals(StringUtils.parseName(user)); String title = "Smack Debug Window -- " + (isAnonymous ? "" : StringUtils.parseBareAddress(user)) + "@" + connection.getServiceName() + ":" + connection.getPort(); title += "/" + StringUtils.parseResource(user); frame.setTitle(title); }
/** * Returns the presence info for a particular user's resource, or unavailable presence * if the user is offline or if no presence information is available, such as * when you are not subscribed to the user's presence updates. * * @param userWithResource a fully qualified XMPP ID including a resource (user@domain/resource). * @return the user's current presence, or unavailable presence if the user is offline * or if no presence information is available. */ public Presence getPresenceResource(String userWithResource) { String key = getPresenceMapKey(userWithResource); String resource = StringUtils.parseResource(userWithResource); Map<String, Presence> userPresences = presenceMap.get(key); if (userPresences == null) { Presence presence = new Presence(Presence.Type.unavailable); presence.setFrom(userWithResource); return presence; } else { Presence presence = userPresences.get(resource); if (presence == null) { presence = new Presence(Presence.Type.unavailable); presence.setFrom(userWithResource); return presence; } else { return presence; } } }
@Test public void testEncodeHex() throws UnsupportedEncodingException { String input = ""; String output = ""; assertEquals(new String(StringUtils.encodeHex(input.getBytes(StringUtils.UTF8))), output); input = "foo bar 123"; output = "666f6f2062617220313233"; assertEquals(new String(StringUtils.encodeHex(input.getBytes(StringUtils.UTF8))), output); }
/** * Creates an Jingle session to start a communication with another user. * * @param responder the fully qualified jabber ID with resource of the other * user. * @return The session on which the negotiation can be run. */ public JingleSession createOutgoingJingleSession(String responder) throws XMPPException { if (responder == null || StringUtils.parseName(responder).length() <= 0 || StringUtils.parseServer(responder).length() <= 0 || StringUtils.parseResource(responder).length() <= 0) { throw new IllegalArgumentException("The provided user id was not fully qualified"); } JingleSession session = new JingleSession(connection, (JingleSessionRequest) null, connection.getUser(), responder, jingleMediaManagers); triggerSessionCreated(session); return session; }
/** * Returns the Form to use for searching transcripts. It is unlikely that the server * will change the form (without a restart) so it is safe to keep the returned form * for future submissions. * * @return the Form to use for searching transcripts. * @throws XMPPException if an error occurs while sending the request to the server. */ public Form getTranscriptSearchForm() throws XMPPException { return transcriptSearchManager.getSearchForm(StringUtils.parseServer(workgroupJID)); }
public String getUser() { return StringUtils.parseName(occupant.getJid()); }
/** * Sets the unique ID of the packet. To indicate that a stanza has no id * pass <code>null</code> as the packet's id value. * * @param id the unique ID for the packet. */ public void setStanzaId(String id) { if (id != null) { requireNotNullNorEmpty(id, "id must either be null or not the empty String"); } this.id = id; }
public boolean accept(Packet p) { String from = p.getFrom(); if (from == null) { return false; } return roomAddressTable.containsKey(StringUtils.parseBareAddress(from).toLowerCase()); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Presence Stanza ["); logCommonAttributes(sb); sb.append("type=").append(type).append(','); if (mode != null) { sb.append("mode=").append(mode).append(','); } if (!StringUtils.isNullOrEmpty(status)) { sb.append("status=").append(status).append(','); } if (priority != Integer.MIN_VALUE) { sb.append("prio=").append(priority).append(','); } sb.append(']'); return sb.toString(); }
public void addTagContent() { appendEmptyTag(type); appendEmptyTag("INTERNET"); appendEmptyTag("PREF"); appendTag("USERID", StringUtils.escapeForXML(email)); } });
/** * @param packet */ public void processPacket(Packet packet) { PresenceIndicator.getDefault().label.setText(KenaiUser.getOnlineUserCount()>0?KenaiUser.getOnlineUserCount()-1+"":""); // NOI18N PresenceIndicator.getDefault().label.setToolTipText(NbBundle.getMessage(PresenceIndicator.class, "LBL_LoggedIn_Tooltip", KenaiUser.getOnlineUserCount()>0?KenaiUser.getOnlineUserCount()-1:"")); for (MultiUserChat muc : KenaiConnection.getDefault(KenaiConnection.getKenai(StringUtils.parseBareAddress(packet.getFrom()))).getChats()) { String chatName = StringUtils.parseName(muc.getRoom()); assert chatName != null : "muc.getRoom() = " + muc.getRoom(); // NOI18N ChatNotifications.getDefault().getMessagingHandle(KenaiConnection.getKenaiProject(muc)).setOnlineCount(muc.getOccupantsCount()); } } }
private void refreshOnlineStatus() throws MissingResourceException { if (muc!=null) { online.setText(muc.getOccupantsCount()+""); //NOI18N Iterator<String> string = muc.getOccupants(); StringBuffer buffer = new StringBuffer(); buffer.append("<html><body>"); // NOI18N while (string.hasNext()) { buffer.append(StringUtils.parseResource(string.next()) + "<br>"); // NOI18N } buffer.append("</body></html>"); // NOI18N online.setToolTipText(buffer.toString()); } }