public String getUser() { return StringUtils.parseName(occupant.getJid()); }
public String getShortName() { return StringUtils.parseName(getName()); }
/** * is user online * @param user's FQN * @return */ public static boolean isOnline(String user) { assert user !=null; assert user.contains("@"): "username must be FQN"; assert !user.contains("/"): "username cannot contain '/'"; Kenai k = getKenai(user); synchronized (k.onlineUsers) { return k.onlineUsers.contains(StringUtils.parseName(user)); } }
public String getName() { return StringUtils.parseName(muc.getRoom()); }
public static KenaiUser forName(final String name) { assert name !=null; assert name.contains("@"): "username must be FQN"; assert !name.contains("/"): "username cannot contain '/'"; Kenai kenai = getKenai(name); assert kenai!=null: "kenai instance not found for " + name; synchronized (kenai.users) { String shortName = StringUtils.parseName(name); KenaiUser user = kenai.users.get(shortName); if (user==null) { user = new KenaiUser(kenai, name); kenai.users.put(shortName, user); } return user; } }
/** * Checks if a given Friend is part of this group. * * @param friend * The friend * @return True if this group contains the friend, false otherwise. */ public boolean contains(Friend friend) { for (final Friend f : getFriends()) { if (StringUtils.parseName(f.getUserId()).equals( StringUtils.parseName(friend.getUserId()))) { return true; } } return false; }
public String getName(String userId) throws IOException { final String summonerId = StringUtils.parseName(userId).replace("sum", ""); final String response = request("https://" + server.api + "/api/lol/" + server.getApiRegion() + "/v1.4/summoner/" + summonerId + "/name?api_key=" + riotApiKey.getKey()); final Map<String, String> summoner = new GsonBuilder().create() .fromJson(response, new TypeToken<Map<String, String>>() { }.getType()); return summoner.get(summonerId); }
/** * Adds listener to given MultiUserChat * only one listener can listen on given MultiUserChat * @param muc * @param lsn */ public synchronized void join(MultiUserChat muc, PacketListener lsn) { final String name = StringUtils.parseName(muc.getRoom()); PacketListener put = groupListeners.put(name, lsn); for (Message m : groupMessageQueue.get(name)) { lsn.processPacket(m); } assert put == null:"Chat room " + muc.getRoom() + " already joined"; }
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); }
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); }
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); }
/** * 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; }
public void userHasLogged(String user) { boolean isAnonymous = "".equals(StringUtils.parseName(user)); String title = "User logged (" + connection.hashCode() + "): " + (isAnonymous ? "" : StringUtils.parseBareAddress(user)) + "@" + connection.getServiceName() + ":" + connection.getPort(); title += "/" + StringUtils.parseResource(user); System.out.println(title); // Add the connection listener to the connection so that the debugger can be notified // whenever the connection is closed. connection.addConnectionListener(connListener); }
public void userHasLogged(String user) { boolean isAnonymous = "".equals(StringUtils.parseName(user)); String title = "User logged (" + connection.hashCode() + "): " + (isAnonymous ? "" : StringUtils.parseBareAddress(user)) + "@" + connection.getServiceName() + ":" + connection.getPort(); title += "/" + StringUtils.parseResource(user); System.out.println(title); // Add the connection listener to the connection so that the debugger can be notified // whenever the connection is closed. connection.addConnectionListener(connListener); }
/** * Creates an Jingle session to start a communication with another user. * * @param responder the fully qualified jabber ID with resource of the other * user. * @param payloadTypes list of supported payload types * @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; }
public void userHasLogged(String user) { boolean isAnonymous = "".equals(StringUtils.parseName(user)); String title = "User logged (" + connection.hashCode() + "): " + (isAnonymous ? "" : StringUtils.parseBareAddress(user)) + "@" + connection.getServiceName() + ":" + connection.getPort(); title += "/" + StringUtils.parseResource(user); System.out.println(title); // Add the connection listener to the connection so that the debugger can be notified // whenever the connection is closed. connection.addConnectionListener(connListener); }
public void userHasLogged(String user) { boolean isAnonymous = "".equals(StringUtils.parseName(user)); String title = "User logged (" + connection.hashCode() + "): " + (isAnonymous ? "" : StringUtils.parseBareAddress(user)) + "@" + connection.getServiceName() + ":" + connection.getPort(); title += "/" + StringUtils.parseResource(user); Log.d("SMACK", title); // Add the connection listener to the connection so that the debugger can be notified // whenever the connection is closed. connection.addConnectionListener(connListener); }
public void userHasLogged(String user) { boolean isAnonymous = "".equals(StringUtils.parseName(user)); String title = "User logged (" + connection.hashCode() + "): " + (isAnonymous ? "" : StringUtils.parseBareAddress(user)) + "@" + connection.getServiceName() + ":" + connection.getPort(); title += "/" + StringUtils.parseResource(user); System.out.println(title); // Add the connection listener to the connection so that the debugger can be notified // whenever the connection is closed. connection.addConnectionListener(connListener); }
/** * @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()); } } }
public void setActiveGroup(String name) { Utilities.assertJid(name); ChatNotifications.getDefault().removeGroup(name); int indexOfTab = getTab(name); if (indexOfTab < 0) { MultiUserChat muc = KenaiConnection.getDefault(KenaiConnection.getKenai(name)).getChat(StringUtils.parseName(name)); if (muc != null) { ChatPanel chatPanel = new ChatPanel(muc); addChat(chatPanel); indexOfTab=chats.getTabCount()-1; chats.setSelectedComponent(chatPanel); } } else { chats.setSelectedIndex(indexOfTab); } } public void setActivePrivate(String name) {