Пример #1
0
  /** On disconnect */
  @Override
  public void onDisconnect() {
    // Call parent method to ensure "register" status is tracked
    super.onDisconnect();

    if (service.getSettings().isReconnectEnabled() && server.getStatus() != Status.DISCONNECTED) {
      setAutojoinChannels(server.getCurrentChannelNames());

      server.setStatus(Status.CONNECTING);
      service.connect(server);
    } else {
      server.setStatus(Status.DISCONNECTED);
    }

    service.notifyDisconnected(server.getTitle());

    Intent sIntent = Broadcast.createServerIntent(Broadcast.SERVER_UPDATE, server.getId());
    service.sendBroadcast(sIntent);

    Collection<Conversation> conversations = server.getConversations();

    for (Conversation conversation : conversations) {
      Message message = new Message(service.getString(R.string.message_disconnected));
      message.setIcon(R.drawable.error);
      message.setColor(Message.COLOR_RED);
      server.getConversation(conversation.getName()).addMessage(message);

      Intent cIntent =
          Broadcast.createConversationIntent(
              Broadcast.CONVERSATION_MESSAGE, server.getId(), conversation.getName());
      service.sendBroadcast(cIntent);
    }

    synchronized (isQuittingLock) {
      isQuitting = false;
      if (disposeRequested) {
        super.dispose();
      }
    }
  }
Пример #2
0
  protected void onDisconnect() {
    // TODO Auto-generated method stub
    super.onDisconnect();
    while (true) {

      try {
        Thread.sleep(60000);
        reconnect();
      } catch (NickAlreadyInUseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (IrcException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }