private void saveRecentList() {
    DataOutputStream os = NvStorage.CreateDataOutputStream();
    try {
      for (Enumeration e = recentList.elements(); e.hasMoreElements(); ) {
        String s = (String) e.nextElement();
        os.writeUTF(s);
      }
    } catch (Exception e) {
    }

    NvStorage.writeFileRecord(os, id, 0, true);
  }
  private void loadRecentList() {
    recentList = new Vector(10);
    try {
      DataInputStream is = NvStorage.ReadFileRecord(id, 0);

      while (is.available() > 0) recentList.addElement(is.readUTF());
      is.close();
    } catch (Exception e) {
    }
  }
 void rmsUpdate() {
   DataOutputStream outputStream = NvStorage.CreateDataOutputStream();
   for (int i = 0; i < accountList.size(); i++)
     ((Account) accountList.elementAt(i)).saveToDataOutputStream(outputStream);
   NvStorage.writeFileRecord(outputStream, Account.storage, 0, true);
 }
  public void saveToStorage() {

    DataOutputStream outputStream = NvStorage.CreateDataOutputStream();

    try {
      outputStream.writeInt(accountIndex);
      outputStream.writeBoolean(showOfflineContacts);
      outputStream.writeBoolean(fullscreen);
      outputStream.writeInt(def_profile);
      outputStream.writeBoolean(smiles);
      outputStream.writeBoolean(showTransports);
      outputStream.writeBoolean(selfContact);
      outputStream.writeBoolean(collapsedGroups);
      outputStream.writeBoolean(ignore);
      outputStream.writeBoolean(eventComposing);

      outputStream.writeInt(gmtOffset);
      outputStream.writeInt(locOffset);

      outputStream.writeBoolean(autoLogin);
      outputStream.writeBoolean(autoJoinConferences);

      outputStream.writeBoolean(popupFromMinimized);

      outputStream.writeBoolean(notifyBlink);
      outputStream.writeBoolean(memMonitor);

      outputStream.writeInt(font1);
      outputStream.writeInt(font2);

      outputStream.writeBoolean(autoFocus);

      outputStream.writeInt(notInListDropLevel /*keepAlive*/);

      outputStream.writeBoolean(storeConfPresence);

      outputStream.writeBoolean(capsState);

      outputStream.writeInt(textWrap);

      outputStream.writeInt(loginstatus);

      outputStream.writeUTF(msgPath);
      outputStream.writeBoolean(msgLog);
      outputStream.writeBoolean(msgLogPresence);
      outputStream.writeBoolean(msgLogConfPresence);
      outputStream.writeBoolean(msgLogConf);
      outputStream.writeBoolean(cp1251);

      outputStream.writeInt(autoAwayDelay);

      outputStream.writeUTF(defGcRoom);

      outputStream.writeBoolean(altInput);

      outputStream.writeInt(isbottom);

      outputStream.writeInt(confMessageCount);

      outputStream.writeBoolean(newMenu);

      outputStream.writeBoolean(lightState);

      outputStream.writeBoolean(notifySound);

      outputStream.writeBoolean(lastMessages);

      outputStream.writeBoolean(setAutoStatusMessage);

      outputStream.writeInt(autoAwayType);

      outputStream.writeBoolean(autoScroll);

      outputStream.writeBoolean(popUps);

      outputStream.writeBoolean(showResources);

      outputStream.writeBoolean(antispam);

      outputStream.writeBoolean(enableVersionOs);

      outputStream.writeInt(messageLimit);

      outputStream.writeUTF(lang);

      outputStream.writeBoolean(eventDelivery);

      outputStream.writeBoolean(transliterateFilenames);

      outputStream.writeBoolean(rosterStatus);

      outputStream.writeBoolean(queryExit);

      outputStream.writeBoolean(notifyPicture);
      outputStream.writeBoolean(showBalloons);

      outputStream.writeBoolean(userKeys);

      outputStream.writeInt(msglistLimit);

      outputStream.writeBoolean(useTabs);

      outputStream.writeInt(autoSubscribe);

      outputStream.writeBoolean(useBoldFont);

    } catch (Exception e) {
    }

    NvStorage.writeFileRecord(outputStream, "config", 0, true);
  }
  protected void loadFromStorage() {
    DataInputStream inputStream = NvStorage.ReadFileRecord("config", 0);
    try {
      accountIndex = inputStream.readInt();
      showOfflineContacts = inputStream.readBoolean();
      fullscreen = inputStream.readBoolean();
      def_profile = inputStream.readInt();
      smiles = inputStream.readBoolean();
      showTransports = inputStream.readBoolean();
      selfContact = inputStream.readBoolean();
      collapsedGroups = inputStream.readBoolean();
      ignore = inputStream.readBoolean();
      eventComposing = inputStream.readBoolean();

      gmtOffset = inputStream.readInt();
      locOffset = inputStream.readInt();

      autoLogin = inputStream.readBoolean();
      autoJoinConferences = inputStream.readBoolean();

      popupFromMinimized = inputStream.readBoolean();

      notifyBlink = inputStream.readBoolean();
      memMonitor = inputStream.readBoolean();

      font1 = inputStream.readInt();
      font2 = inputStream.readInt();

      autoFocus = inputStream.readBoolean();

      notInListDropLevel = inputStream.readInt();

      storeConfPresence = inputStream.readBoolean();

      capsState = inputStream.readBoolean();

      textWrap = inputStream.readInt();

      loginstatus = inputStream.readInt();

      msgPath = inputStream.readUTF();
      msgLog = inputStream.readBoolean();
      msgLogPresence = inputStream.readBoolean();
      msgLogConfPresence = inputStream.readBoolean();
      msgLogConf = inputStream.readBoolean();
      cp1251 = inputStream.readBoolean();

      autoAwayDelay = inputStream.readInt();

      defGcRoom = inputStream.readUTF();

      altInput = inputStream.readBoolean();

      isbottom = inputStream.readInt();

      confMessageCount = inputStream.readInt();

      newMenu = inputStream.readBoolean();

      lightState = inputStream.readBoolean();

      notifySound = inputStream.readBoolean();

      lastMessages = inputStream.readBoolean();

      setAutoStatusMessage = inputStream.readBoolean();

      autoAwayType = inputStream.readInt();

      autoScroll = inputStream.readBoolean();

      popUps = inputStream.readBoolean();

      showResources = inputStream.readBoolean();

      antispam = inputStream.readBoolean();

      enableVersionOs = inputStream.readBoolean();

      messageLimit = inputStream.readInt();

      lang = inputStream.readUTF();

      eventDelivery = inputStream.readBoolean();

      transliterateFilenames = inputStream.readBoolean();

      rosterStatus = inputStream.readBoolean();

      queryExit = inputStream.readBoolean();

      notifyPicture = inputStream.readBoolean();

      showBalloons = inputStream.readBoolean();

      userKeys = inputStream.readBoolean();

      msglistLimit = inputStream.readInt();

      useTabs = inputStream.readBoolean();

      autoSubscribe = inputStream.readInt();

      useBoldFont = inputStream.readBoolean();

      inputStream.close();
    } catch (Exception e) {
      try {
        if (inputStream != null) inputStream.close();
      } catch (IOException ex) {
      }
    }

    lastProfile = profile = def_profile;
    if (lastProfile == AlertProfile.VIBRA) lastProfile = 0;
    updateTime();
    VirtualList.fullscreen = fullscreen;
    VirtualList.isbottom = isbottom;
    VirtualList.memMonitor = memMonitor;
    VirtualList.showBalloons = showBalloons;
    VirtualList.userKeys = userKeys;
  }