public Message[] removeDecodedMessages() {
    if (messages_last_read.isEmpty()) return null;

    Message[] msgs = (Message[]) messages_last_read.toArray(new Message[messages_last_read.size()]);

    messages_last_read.clear();

    return msgs;
  }
 public ConfigSection[] getConfigSections() {
   ArrayList<ConfigSection> list = ConfigSectionRepository.getInstance().getList();
   for (Iterator<ConfigSection> iter = list.iterator(); iter.hasNext(); ) {
     ConfigSection configSection = iter.next();
     if (configSection instanceof ConfigSectionHolder) {
       if (((ConfigSectionHolder) configSection).getPluginInterface() != this) {
         iter.remove();
       }
     }
   }
   return list.toArray(new ConfigSection[0]);
 }
예제 #3
0
 public static void triggerMetaDataUpdateListeners(TOTorrent torrent) {
   if (torrent == null) {
     return;
   }
   MetaDataUpdateListener[] listeners =
       (MetaDataUpdateListener[]) metaDataListeners.toArray(new MetaDataUpdateListener[0]);
   for (int i = 0; i < listeners.length; i++) {
     MetaDataUpdateListener listener = listeners[i];
     try {
       listener.metaDataUpdated(torrent);
     } catch (Exception e) {
       Debug.out(e);
     }
   }
 }
예제 #4
0
 public static void setHasBeenOpened(DownloadManager dm, boolean opened) {
   TOTorrent torrent = dm.getTorrent();
   if (torrent == null) {
     return;
   }
   if (opened == getHasBeenOpened(dm)) {
     return;
   }
   setContentMapLong(torrent, TOR_AZ_PROP_OPENED, opened ? 1 : 0);
   writeTorrentIfExists(torrent);
   Object[] array = hasBeenOpenedListeners.toArray();
   for (int i = 0; i < array.length; i++) {
     try {
       HasBeenOpenedListener l = (HasBeenOpenedListener) array[i];
       l.hasBeenOpenedChanged(dm, opened);
     } catch (Exception e) {
       Debug.out(e);
     }
   }
 }