String getThreadId(User user) {
   String id = myUser2Thread.get(user.getName());
   if (id == null) {
     id = myThreadIdPrefix + myCurrentThreadId++;
     myUser2Thread.put(user.getName(), id);
   }
   return id;
 }
 private void updateIsIDEtalkClient(String jabberId, User user) {
   if (getResource(jabberId)
       .toLowerCase()
       .startsWith(JabberFacade.IDETALK_RESOURCE.toLowerCase())) {
     myIDEtalkUsers.add(user.getName());
   } else {
     myIDEtalkUsers.remove(user.getName());
   }
 }
Esempio n. 3
0
 void placeOrder(final User user, String cmd, Company comp, int qty, int id) {
   int cmdID = commID++;
   connect(user.getName(), user.getPassword());
   try {
     out.println(cmdID + ";" + cmd + ":" + comp.name + ":" + Integer.toString(qty) + ":" + id);
     out.flush();
     Shares pen = (Shares) receiveReply(cmdID);
     user.getPendingShares().add(pen);
     user.dataChanged();
   } catch (Exception r) {
     r.printStackTrace();
   }
 }
 @Nullable
 private Presence _getPresence(User user) {
   if (!isOnline()) return null;
   return getRoster().getPresence(user.getName());
 }
 static Message createBaseMessage(User user, String message) {
   Message msg = new Message(user.getName(), Message.Type.CHAT);
   msg.setBody(message);
   return msg;
 }
 @Override
 public boolean hasIdeTalkClient(User user) {
   return myIDEtalkUsers.contains(user.getName());
 }
 @Override
 public boolean isSelf(User user) {
   return myFacade.isConnectedAndAuthenticated()
       && getSimpleId(myFacade.getConnection().getUser()).equals(user.getName());
 }