Index: trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/ProxyIM.java
===================================================================
--- trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/ProxyIM.java	(revision 1429)
+++ trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/ProxyIM.java	(revision 1429)
@@ -0,0 +1,59 @@
+/**
+ * @author Alexandre Correia - alexandrecorreia@celepar.pr.gov.br
+ * @ ProxyName e ProxyPort 
+ */
+
+package nu.fw.jeti.util;
+
+import java.util.Iterator;
+import java.util.List;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.URI;
+
+public class ProxyIM
+{
+	private static String proxyServer;
+	private static int proxyPort;
+
+	public static void setProxy(String url)
+	{
+		try
+		{
+			System.setProperty("java.net.useSystemProxies","true");
+			List l = ProxySelector.getDefault().select(new URI(url));
+			
+			for (Iterator iter = l.iterator(); iter.hasNext(); )
+			{
+				Proxy proxy = (Proxy) iter.next();
+				InetSocketAddress addr = (InetSocketAddress)proxy.address();
+
+				if( addr == null )
+				{
+					proxyServer = "";
+					proxyPort = 0;
+				}
+				else
+				{
+					proxyServer = addr.getHostName().toString();
+					proxyPort = addr.getPort();
+				}
+			}
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace();
+		}
+	}
+	
+	public static String getProxyServer()
+	{
+		return proxyServer;
+	}
+
+	public static int getProxyPort()
+	{
+		return proxyPort;
+	}
+}
Index: trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/Digest.java
===================================================================
--- trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/Digest.java	(revision 1429)
+++ trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/Digest.java	(revision 1429)
@@ -0,0 +1,49 @@
+/**
+ * @author Alexandre Correia - alexandrecorreia@celepar.pr.gov.br
+ * @ Calculo do hash para autenticacao Digest
+ */
+package nu.fw.jeti.util;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class Digest
+{
+	private byte[] gHash(String frase, String algoritmo)
+	{
+		try
+		{
+			MessageDigest md = MessageDigest.getInstance(algoritmo);
+			md.update(frase.getBytes());
+			return md.digest();
+		}
+		catch (NoSuchAlgorithmException e)
+		{
+			return null;
+		}
+	}
+	
+	private String stringHexa(byte[] bytes)
+	{
+		StringBuilder s = new StringBuilder();
+		for (int i = 0; i < bytes.length; i++)
+		{
+			int parteAlta = ((bytes[i] >> 4) & 0xf) << 4;
+			int parteBaixa = bytes[i] & 0xf;
+			if (parteAlta == 0) s.append('0');
+			s.append(Integer.toHexString(parteAlta | parteBaixa));
+		}
+		
+		return s.toString();
+	}
+
+	public String hashMD5(String nonce, String cnonce, String qop, String uri, String user, String password, String realm)
+	{
+		String HA1 = stringHexa(gHash( user + ":" + realm + ":" + password, "MD5"));
+		String nc = "00000001";
+		String HA2 = stringHexa(gHash(uri, "MD5"));
+		String DigestPROXY = HA1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + HA2;
+
+		return stringHexa(gHash(DigestPROXY, "MD5"));
+	}
+}
Index: trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/JavaScriptServerExpresso.java
===================================================================
--- trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/JavaScriptServerExpresso.java	(revision 1014)
+++ trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/JavaScriptServerExpresso.java	(revision 1429)
@@ -9,27 +9,57 @@
 package nu.fw.jeti.util;
 
-import netscape.javascript.*;
+import netscape.javascript.JSObject;
 import nu.fw.jeti.jabber.elements.Presence;
 
 public class JavaScriptServerExpresso
 {
-	String [] param = new String[2];
-	
 	public void cleanStatus()
 	{
+		final String[] param = new String[2];
 		param[0] = "cleanStatus";	
 		param[1] = " ";
 
-		ThreadJavascript tt = new ThreadJavascript("getArgumentsApplet", param[0], param[1]);
-		tt.start();
+		Thread cleanSt = new Thread()
+		{
+			public void run()
+			{
+				try
+				{
+					if( nu.fw.jeti.applet.Jeti.WINDOWAPPLET != null )
+					{
+						JSObject winApplet = nu.fw.jeti.applet.Jeti.WINDOWAPPLET;
+						winApplet.call("getArgumentsApplet", param);			
+					}
+				}
+				catch(Exception e){}
+			}
+		};
+		
+		cleanSt.start();
 	}
 	
 	private void ExecuteJs(int Status)
 	{
+		final String[] param = new String[2];
 		param[0] = "getArgumentsApplet";
 		param[1] = (String)this.TypeStatus(Status);
+
+		Thread ExeJs = new Thread()
+		{
+			public void run()
+			{
+				try
+				{
+					if( nu.fw.jeti.applet.Jeti.WINDOWAPPLET != null )
+					{
+						JSObject winApplet = nu.fw.jeti.applet.Jeti.WINDOWAPPLET;
+						winApplet.call("getArgumentsApplet", param);			
+					}
+				}
+				catch(Exception e){}
+			}
+		};
 		
-		ThreadJavascript tt = new ThreadJavascript("getArgumentsApplet", param[0], param[1]);
-		tt.start();
+		ExeJs.start();
 	}
 
@@ -56,32 +86,3 @@
 		return nameStatus;
 	}
-	
-	public void writeSubStatus(int status, String message)
-	{
-		param[0] = "writeSubStatus";
-		param[1] = status + "-" + message;
-
-		ThreadJavascript tt = new ThreadJavascript("getArgumentsApplet", param[0], param[1]);
-		tt.start();
-
-	}
 }
-
-class ThreadJavascript extends Thread
-{
-	private String name;
-	private String[] param = new String[2];
-	
-	public ThreadJavascript(String Name, String Param1, String Param2)
-	{
-		this.name  = Name;
-		this.param[0] = Param1;
-		this.param[1] = Param2;		
-	}
-
-	public void run()
-	{
-		JSObject winApplet = nu.fw.jeti.applet.Jeti.WINDOWAPPLET;
-		winApplet.call(this.name, this.param);
-	}
-}
