Пример #1
0
 private void sendFeature(String account, String user, String session, Feature feature) {
   Message message = new Message(user, Message.Type.normal);
   message.setThread(session);
   message.addExtension(feature);
   try {
     ConnectionManager.getInstance().sendStanza(account, message);
   } catch (NetworkException e) {
   }
 }
 /**
  * Called when disconnect should occur.
  *
  * @param connectionThread
  * @return <code>true</code> if connection thread was managed.
  */
 private boolean onDisconnect(ConnectionThread connectionThread) {
   XMPPConnection xmppConnection = connectionThread.getXMPPConnection();
   boolean acceptable = isManaged(connectionThread);
   if (xmppConnection == null) LogManager.i(this, "onClose " + acceptable);
   else
     LogManager.i(
         this,
         "onClose "
             + xmppConnection.hashCode()
             + " - "
             + xmppConnection.connectionCounterValue
             + ", "
             + acceptable);
   ConnectionManager.getInstance().onDisconnect(connectionThread);
   if (acceptable) connectionThread.shutdown();
   return acceptable;
 }
Пример #3
0
 /**
  * Sends invitation.
  *
  * @param account
  * @param room
  * @param user
  * @throws NetworkException
  */
 public void invite(String account, String room, String user) throws NetworkException {
   RoomChat roomChat = getRoomChat(account, room);
   if (roomChat == null || roomChat.getState() != RoomState.available) {
     Application.getInstance().onError(R.string.NOT_CONNECTED);
     return;
   }
   Message message = new Message(room);
   MUCUser mucUser = new MUCUser();
   MUCUser.Invite invite = new MUCUser.Invite();
   invite.setTo(user);
   invite.setReason("");
   mucUser.setInvite(invite);
   message.addExtension(mucUser);
   ConnectionManager.getInstance().sendPacket(account, message);
   roomChat.putInvite(message.getPacketID(), user);
   roomChat.newAction(roomChat.getNickname(), user, ChatAction.invite_sent);
 }
Пример #4
0
 @Override
 public void onAccept(DialogBuilder dialogBuilder) {
   switch (dialogBuilder.getDialogId()) {
     case R.string.cache_clear_warning:
       AccountManager.getInstance().setStatus(StatusMode.unavailable, null);
       ((Application) getApplication()).requestToClear();
       Application.getInstance().requestToClose();
       showDialog(R.string.application_state_closing);
       break;
     case R.string.security_clear_certificate_warning:
       CertificateManager.getInstance().removeCertificates();
       ConnectionManager.getInstance().updateConnections(true);
       break;
     case R.string.contacts_reset_offline_warning:
       GroupManager.getInstance().resetShowOfflineModes();
       break;
   }
 }