Пример #1
0
 @Subscribe
 public void onP2PConnectionEvent(P2PConnectionEvent e) {
   if (e.isConnected()) {
     // resend invites
     Friends friends = model.getFriends();
     ArrayList<String> pendingInvites = new ArrayList<String>(model.getPendingInvites());
     for (String email : pendingInvites) {
       log.info("Resending pending invite to {}", email);
       Friend friend = friends.get(email);
       xmppHandler.sendInvite(friend, true);
     }
   }
 }
Пример #2
0
 public void invite(Friend friend) {
   String email = friend.getEmail();
   try {
     if (xmppHandler.sendInvite(friend, false)) {
       // we need to mark this email as pending, in case
       // our invite gets lost.
       model.addPendingInvite(email);
     }
   } catch (Exception e) {
     log.debug("failed to send invite: ", e);
     model.addPendingInvite(email);
   }
   Events.sync(SyncPath.FRIENDS, model.getFriends().getFriends());
 }