Example #1
0
 @Override
 public void disconnect() {
   if (appSession != null) {
     appSession.closeAimSession(aimSession.getScreenname());
     accountListener.accountDidDisconnect(this);
   }
 }
Example #2
0
  @Override
  public boolean connect(AccountLoginListener loginListener) {
    Screenname name = new Screenname(this.getUserName());
    AimConnectionProperties props = new AimConnectionProperties(name, this.getPassword());
    try {
      File dir = Util.getInstance().activity.getDir("aimconfig", Context.MODE_PRIVATE);
      DAppSession sess = new DAppSession(new File(dir.getAbsolutePath(), ".dolca"));
      sess.setSavePrefsOnExit(true);
      aimSession = (DAimAppSession) sess.openAimSession(name);
      connection = aimSession.openConnection(props);

      connection.addStateListener(connStateListener);
      //			connection.addOpenedServiceListener(new OpenedServiceListener() {
      //
      //				public void openedServices(AimConnection conn,
      //						Collection<? extends Service> services) {
      //					// TODO Auto-generated method stub
      //
      //				}
      //
      //				public void closedServices(AimConnection conn,
      //						Collection<? extends Service> services) {
      //					// TODO Auto-generated method stub
      //
      //				}
      //			})

      connection.connect();
      this.loginListener = loginListener;

    } catch (Exception e) {
      String errorMessage = e.getLocalizedMessage();
      loginListener.loginDidFailedWithError(errorMessage != null ? errorMessage : e.toString());
      return false;
    }
    return true;
  }