/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package controller.commands;

import controller.CommandInterface;
import gui.Hauptfenster;
import java.util.logging.Level;
import java.util.logging.Logger;
import logger.OhmLogger;
import model.SIPmodel;

/**
 *
 * @author Jan
 * Registrierung auf Proxy Server
 */
public class CommandRegister implements CommandInterface
{ 
  private static final Logger lgregister = OhmLogger.getLogger(); 
  private SIPmodel model;
  private Hauptfenster view;
  public CommandRegister(SIPmodel model, Hauptfenster view)
  {
    this.model = model;
    this.view = view;         
  }
  
  @Override
  public void execute() 
  {
    try
    { 
      view.getTxtArea().append("Registrierung an " +  view.getTxtServerIP().getText() + " gesendet\n");
      model.sendRegister(view.getTxtServerIP().getText(), 5060);
      
    }
    catch (Exception ex)
    {
      view.getTxtArea().append("Registrierung fehlgeschlagen\n");
      lgregister.getLogger(CommandRegister.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  

  @Override
  public void undo()
  {
    
  }

  @Override
  public Boolean isundoable()
  {
    return false;
  }
}
