FileDocCategorySizeDatePackage
TorrentHost.javaAPI DocAzureus 3.0.3.42566Tue Oct 31 15:10:32 GMT 2006org.gudy.azureus2.ui.console.commands

TorrentHost

public class TorrentHost extends TorrentCommand
console command to host a torrent. extracted from the Torrent class written by tobias

Fields Summary
Constructors Summary
public TorrentHost()

		super(new String[] { "host"}, "Hosting");
	
Methods Summary
public java.lang.StringgetCommandDescriptions()

		return("host (<torrentoptions>)\t\t\tHost or stop hosting torrent(s).");
	
protected booleanperformCommand(org.gudy.azureus2.ui.console.ConsoleInput ci, org.gudy.azureus2.core3.download.DownloadManager dm, java.util.List args)

		TOTorrent torrent = dm.getTorrent();
        if (torrent != null) {
          try {
            	TRHost	host = ci.azureus_core.getTrackerHost();
            	
            	TRHostTorrent	existing = host.getHostTorrent( torrent );
            	
            	if ( existing == null ){
            		
            		 ci.azureus_core.getTrackerHost().hostTorrent(torrent,true, false);
            		 
            	}else{
            		try{
            			existing.remove();
            			
            		}catch( Throwable e ){
            			
            			e.printStackTrace();
            		}
            	}
           
          } catch (TRHostException e) {
            e.printStackTrace(ci.out);
            return false;
          }
          return true;
        }
        return false;