Exemplo n.º 1
0
  public void sendMessage(Download download, String text) {
    if (download == null) return;

    byte[] peerID = download.getDownloadPeerId();
    if (peerID != null) {
      controller.sendMessage(download, peerID, nick, text);
    } else {
      messageReceived(
          download, null, "System", "/me : Torrent isn't running, message can't be delivered");
    }
  }
Exemplo n.º 2
0
  public void addMessageListener(MessageListener listener, Download download) {
    synchronized (listeners) {
      listeners.add(listener);
      listenersDownload.add(download);
    }

    listener.downloadAdded(download);
    if (controller.isDownloadActive(download)) {
      listener.downloadActive(download);
    } else {
      listener.downloadInactive(download);
    }
  }
Exemplo n.º 3
0
 public void addIgnore(String nick) {
   if (controller != null) controller.ignore(nick);
 }
Exemplo n.º 4
0
  public void initialize() {
    //    plugin_interface  = _pi;

    formatters = new FormattersImpl(); // plugin_interface.getUtilities().getFormatters();

    //    genericTorrent = loadTorrent(resTorrent);
    genericTorrent = this.loadTorrent(resTorrent);
    System.out.println("generic Torrent: " + genericTorrent);
    this.addChannel("Download");
    //    PluginConfigUIFactory factory = plugin_interface.getPluginConfigUIFactory();
    //    Parameter parameters[] = new Parameter[2];
    //    parameters[0] = factory.createBooleanParameter("enable","chat.config.enable",true);
    //    parameters[1] = factory.createStringParameter("nick","chat.config.nick","");
    //    parameters[1].addConfigParameterListener(this);
    //    plugin_interface.addConfigUIParameters(parameters,ID_VIEW_TITLE);

    //    nick = plugin_interface.getPluginconfig().getPluginStringParameter("nick","Guest" + (int)
    // (Math.random() * 100000));
    //    active = plugin_interface.getPluginconfig().getPluginBooleanParameter("enable",true);
    nick = "tester";
    active = true;
    if (active) {
      listeners = new ArrayList();
      listenersDownload = new ArrayList();

      controller = new PeerControllerImpl(this);
      controller.addMessageListener(this);
      controller.initialize();
      controller.startPeerProcessing();

      //  	plugin_interface.getUIManager().addUIListener(
      //			new UIManagerListener()
      //			{
      //				public void
      //				UIAttached(
      //					UIInstance		instance )
      //				{
      //					if ( instance instanceof UISWTInstance ){
      //
      //						swtui = (UISWTInstance)instance;
      //
      //					    imgInactive = loadImage(resInactive);
      //					    imgActive   = loadImage(resActive);
      //					    imgActivity = loadImage(resActivity);
      //
      //					  ChatPanelsManager cpm = new ChatPanelsManager(ChatPlugin.this);
      //						swtui.addView(UISWTInstance.VIEW_MYTORRENTS, "Chat", cpm);
      //						swtui.addView(UISWTInstance.VIEW_MAIN, "CreateChat", cpm);
      //
      //						addMyTorrentsColumn();
      //					}
      //				}
      //
      //				public void
      //				UIDetached(
      //					UIInstance		instance )
      //				{
      //
      //				}
      //			});
      //
    }
  }