libs/new-android-r1.diff
author Da Risk <darisk972@gmail.com>
Sat, 26 Dec 2009 17:45:02 +0100
changeset 605 bccd99644eac
parent 19 213b84d2e743
permissions -rw-r--r--
Change the image for status in the chat activity. various correction in strings.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     1
Index: source/org/jivesoftware/smack/XMPPConnection.java
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     2
===================================================================
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     3
--- source/org/jivesoftware/smack/XMPPConnection.java	(révision 10982)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     4
+++ source/org/jivesoftware/smack/XMPPConnection.java	(copie de travail)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     5
@@ -1082,7 +1082,7 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     6
                     catch (Exception ex) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     7
                         try {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     8
                             debuggerClass =
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
     9
-                                    Class.forName("org.jivesoftware.smack.debugger.LiteDebugger");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    10
+                                    Class.forName("org.jivesoftware.smack.debugger.ConsoleDebugger");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    11
                         }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    12
                         catch (Exception ex2) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    13
                             ex2.printStackTrace();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    14
Index: source/org/jivesoftware/smack/sasl/SASLMechanism.java
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    15
===================================================================
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    16
--- source/org/jivesoftware/smack/sasl/SASLMechanism.java	(révision 10982)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    17
+++ source/org/jivesoftware/smack/sasl/SASLMechanism.java	(copie de travail)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    18
@@ -20,24 +20,18 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    19
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    20
 package org.jivesoftware.smack.sasl;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    21
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    22
-import org.jivesoftware.smack.XMPPException;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    23
-import org.jivesoftware.smack.SASLAuthentication;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    24
-import org.jivesoftware.smack.util.Base64;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    25
-
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    26
 import java.io.IOException;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    27
-import java.util.Map;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    28
 import java.util.HashMap;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    29
+import java.util.Map;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    30
+
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    31
+import javax.security.auth.callback.Callback;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    32
 import javax.security.auth.callback.CallbackHandler;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    33
 import javax.security.auth.callback.UnsupportedCallbackException;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    34
-import javax.security.auth.callback.Callback;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    35
-import javax.security.auth.callback.NameCallback;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    36
-import javax.security.auth.callback.PasswordCallback;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    37
-import javax.security.sasl.RealmCallback;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    38
-import javax.security.sasl.RealmChoiceCallback;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    39
-import javax.security.sasl.Sasl;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    40
-import javax.security.sasl.SaslClient;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    41
-import javax.security.sasl.SaslException;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    42
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    43
+import org.jivesoftware.smack.SASLAuthentication;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    44
+import org.jivesoftware.smack.XMPPException;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    45
+import org.jivesoftware.smack.util.Base64;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    46
+
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    47
 /**
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    48
  * Base class for SASL mechanisms. Subclasses must implement these methods:
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    49
  * <ul>
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    50
@@ -56,7 +50,7 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    51
 public abstract class SASLMechanism implements CallbackHandler {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    52
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    53
     private SASLAuthentication saslAuthentication;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    54
-    protected SaslClient sc;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    55
+    //protected SaslClient sc;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    56
     protected String authenticationId;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    57
     protected String password;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    58
     protected String hostname;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    59
@@ -88,7 +82,7 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    60
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    61
         String[] mechanisms = { getName() };
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    62
         Map<String,String> props = new HashMap<String,String>();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    63
-        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    64
+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    65
         authenticate();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    66
     }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    67
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    68
@@ -105,7 +99,7 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    69
     public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    70
         String[] mechanisms = { getName() };
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    71
         Map<String,String> props = new HashMap<String,String>();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    72
-        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    73
+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    74
         authenticate();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    75
     }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    76
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    77
@@ -113,17 +107,17 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    78
         StringBuilder stanza = new StringBuilder();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    79
         stanza.append("<auth mechanism=\"").append(getName());
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    80
         stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    81
-        try {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    82
-            if(sc.hasInitialResponse()) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    83
-                byte[] response = sc.evaluateChallenge(new byte[0]);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    84
-                String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    85
-                if(authenticationText != null && !authenticationText.equals("")) {                 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    86
-                    stanza.append(authenticationText);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    87
-                }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    88
-            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    89
-        } catch (SaslException e) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    90
-            throw new XMPPException("SASL authentication failed", e);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    91
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    92
+//        try {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    93
+//            if(sc.hasInitialResponse()) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    94
+//                byte[] response = sc.evaluateChallenge(new byte[0]);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    95
+//                String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    96
+//                if(authenticationText != null && !authenticationText.equals("")) {                 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    97
+//                    stanza.append(authenticationText);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    98
+//                }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
    99
+//            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   100
+//        } catch (SaslException e) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   101
+//            throw new XMPPException("SASL authentication failed", e);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   102
+//        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   103
         stanza.append("</auth>");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   104
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   105
         // Send the authentication to the server
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   106
@@ -142,12 +136,12 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   107
         // Build the challenge response stanza encoding the response text
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   108
         StringBuilder stanza = new StringBuilder();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   109
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   110
-        byte response[];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   111
-        if(challenge != null) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   112
-            response = sc.evaluateChallenge(Base64.decode(challenge));
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   113
-        } else {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   114
-            response = sc.evaluateChallenge(null);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   115
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   116
+        byte response[] = null;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   117
+//        if(challenge != null) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   118
+//            response = sc.evaluateChallenge(Base64.decode(challenge));
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   119
+//        } else {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   120
+//            response = sc.evaluateChallenge(null);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   121
+//        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   122
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   123
         String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   124
         if(authenticationText.equals("")) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   125
@@ -179,21 +173,21 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   126
      */
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   127
     public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   128
         for (int i = 0; i < callbacks.length; i++) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   129
-            if (callbacks[i] instanceof NameCallback) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   130
-                NameCallback ncb = (NameCallback)callbacks[i];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   131
-                ncb.setName(authenticationId);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   132
-            } else if(callbacks[i] instanceof PasswordCallback) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   133
-                PasswordCallback pcb = (PasswordCallback)callbacks[i];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   134
-                pcb.setPassword(password.toCharArray());
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   135
-            } else if(callbacks[i] instanceof RealmCallback) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   136
-                RealmCallback rcb = (RealmCallback)callbacks[i];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   137
-                rcb.setText(hostname);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   138
-            } else if(callbacks[i] instanceof RealmChoiceCallback){
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   139
-                //unused
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   140
-                //RealmChoiceCallback rccb = (RealmChoiceCallback)callbacks[i];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   141
-            } else {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   142
+//            if (callbacks[i] instanceof NameCallback) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   143
+//                NameCallback ncb = (NameCallback)callbacks[i];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   144
+//                ncb.setName(authenticationId);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   145
+//            } else if(callbacks[i] instanceof PasswordCallback) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   146
+//                PasswordCallback pcb = (PasswordCallback)callbacks[i];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   147
+//                pcb.setPassword(password.toCharArray());
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   148
+//            } else if(callbacks[i] instanceof RealmCallback) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   149
+//                RealmCallback rcb = (RealmCallback)callbacks[i];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   150
+//                rcb.setText(hostname);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   151
+//            } else if(callbacks[i] instanceof RealmChoiceCallback){
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   152
+//                //unused
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   153
+//                //RealmChoiceCallback rccb = (RealmChoiceCallback)callbacks[i];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   154
+//            } else {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   155
                throw new UnsupportedCallbackException(callbacks[i]);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   156
-            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   157
+            //}
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   158
          }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   159
     }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   160
 }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   161
Index: source/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   162
===================================================================
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   163
--- source/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java	(révision 10982)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   164
+++ source/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java	(copie de travail)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   165
@@ -25,8 +25,6 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   166
 import java.io.IOException;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   167
 import java.util.Map;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   168
 import java.util.HashMap;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   169
-import javax.security.sasl.Sasl;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   170
-import javax.security.sasl.SaslClient;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   171
 import javax.security.auth.callback.CallbackHandler;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   172
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   173
 /**
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   174
@@ -62,8 +60,8 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   175
     public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   176
         String[] mechanisms = { getName() };
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   177
         Map props = new HashMap();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   178
-        props.put(Sasl.SERVER_AUTH,"TRUE");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   179
-        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   180
+        //props.put(Sasl.SERVER_AUTH,"TRUE");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   181
+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   182
         authenticate();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   183
     }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   184
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   185
@@ -81,8 +79,8 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   186
     public void authenticate(String username, String host, String password) throws IOException, XMPPException {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   187
         String[] mechanisms = { getName() };
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   188
         Map props = new HashMap();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   189
-        props.put(Sasl.SERVER_AUTH,"TRUE");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   190
-        sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   191
+        //props.put(Sasl.SERVER_AUTH,"TRUE");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   192
+        //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   193
         authenticate();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   194
     }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   195
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   196
Index: source/org/jivesoftware/smack/ConnectionConfiguration.java
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   197
===================================================================
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   198
--- source/org/jivesoftware/smack/ConnectionConfiguration.java	(révision 10982)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   199
+++ source/org/jivesoftware/smack/ConnectionConfiguration.java	(copie de travail)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   200
@@ -57,13 +57,13 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   201
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   202
     private boolean compressionEnabled = false;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   203
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   204
-    private boolean saslAuthenticationEnabled = true;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   205
+    private boolean saslAuthenticationEnabled = false;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   206
     /**
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   207
      * Used to get information from the user
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   208
      */
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   209
     private CallbackHandler callbackHandler;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   210
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   211
-    private boolean debuggerEnabled = XMPPConnection.DEBUG_ENABLED;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   212
+    private boolean debuggerEnabled = true;//XMPPConnection.DEBUG_ENABLED;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   213
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   214
     // Flag that indicates if a reconnection should be attempted when abruptly disconnected
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   215
     private boolean reconnectionAllowed = true;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   216
@@ -517,7 +517,7 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   217
      *        logging into the server.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   218
      */
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   219
     public void setSASLAuthenticationEnabled(boolean saslAuthenticationEnabled) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   220
-        this.saslAuthenticationEnabled = saslAuthenticationEnabled;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   221
+        //this.saslAuthenticationEnabled = saslAuthenticationEnabled;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   222
     }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   223
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   224
     /**
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   225
Index: source/org/jivesoftware/smack/util/DNSUtil.java
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   226
===================================================================
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   227
--- source/org/jivesoftware/smack/util/DNSUtil.java	(révision 10982)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   228
+++ source/org/jivesoftware/smack/util/DNSUtil.java	(copie de travail)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   229
@@ -24,9 +24,6 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   230
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   231
 import javax.naming.NamingEnumeration;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   232
 import javax.naming.directory.Attribute;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   233
-import javax.naming.directory.Attributes;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   234
-import javax.naming.directory.DirContext;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   235
-import javax.naming.directory.InitialDirContext;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   236
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   237
 /**
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   238
  * Utilty class to perform DNS lookups for XMPP services.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   239
@@ -41,13 +38,13 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   240
      */
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   241
     private static Map cache = new Cache(100, 1000*60*10);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   242
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   243
-    private static DirContext context;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   244
+//    private static DirContext context;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   245
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   246
     static {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   247
         try {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   248
             Hashtable env = new Hashtable();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   249
             env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   250
-            context = new InitialDirContext(env);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   251
+ //           context = new InitialDirContext(env);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   252
         }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   253
         catch (Exception e) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   254
             // Ignore.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   255
@@ -79,64 +76,7 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   256
      *      server can be reached at for the specified domain.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   257
      */
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   258
     public static HostAddress resolveXMPPDomain(String domain) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   259
-        if (context == null) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   260
             return new HostAddress(domain, 5222);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   261
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   262
-        String key = "c" + domain;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   263
-        // Return item from cache if it exists.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   264
-        if (cache.containsKey(key)) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   265
-            HostAddress address = (HostAddress)cache.get(key);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   266
-            if (address != null) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   267
-                return address;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   268
-            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   269
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   270
-        String bestHost = domain;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   271
-        int bestPort = 5222;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   272
-        int bestPriority = 0;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   273
-        int bestWeight = 0;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   274
-        try {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   275
-            Attributes dnsLookup = context.getAttributes("_xmpp-client._tcp." + domain, new String[]{"SRV"});
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   276
-            Attribute srvAttribute = dnsLookup.get("SRV");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   277
-            NamingEnumeration srvRecords = srvAttribute.getAll();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   278
-            while(srvRecords.hasMore()) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   279
-				String srvRecord = (String) srvRecords.next();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   280
-	            String [] srvRecordEntries = srvRecord.split(" ");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   281
-	            int priority = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 4]);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   282
-	            int port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   283
-	            int weight = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 3]);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   284
-	            String host = srvRecordEntries[srvRecordEntries.length-1];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   285
-	            
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   286
-	            // Randomize the weight.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   287
-	            weight *= Math.random() * weight;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   288
-	            
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   289
-	            if ((bestPriority == 0) || (priority < bestPriority)) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   290
-	            	// Choose a server with the lowest priority.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   291
-	            	bestPriority = priority;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   292
-	            	bestWeight = weight;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   293
-	            	bestHost = host;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   294
-	            	bestPort = port;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   295
-	            } else if (priority == bestPriority) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   296
-	            	// When we have like priorities then randomly choose a server based on its weight
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   297
-	            	// The weights were randomized above.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   298
-	            	if (weight > bestWeight) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   299
-	            		bestWeight = weight;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   300
-	            		bestHost = host;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   301
-	            		bestPort = port;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   302
-	            	}
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   303
-	            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   304
-			}
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   305
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   306
-        catch (Exception e) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   307
-            // Ignore.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   308
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   309
-        // Host entries in DNS should end with a ".".
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   310
-        if (bestHost.endsWith(".")) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   311
-        	bestHost = bestHost.substring(0, bestHost.length()-1);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   312
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   313
-        HostAddress address = new HostAddress(bestHost, bestPort);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   314
-        // Add item to cache.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   315
-        cache.put(key, address);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   316
-        return address;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   317
     }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   318
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   319
     /**
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   320
@@ -157,49 +97,7 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   321
      *      server can be reached at for the specified domain.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   322
      */
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   323
     public static HostAddress resolveXMPPServerDomain(String domain) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   324
-        if (context == null) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   325
             return new HostAddress(domain, 5269);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   326
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   327
-        String key = "s" + domain;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   328
-        // Return item from cache if it exists.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   329
-        if (cache.containsKey(key)) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   330
-            HostAddress address = (HostAddress)cache.get(key);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   331
-            if (address != null) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   332
-                return address;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   333
-            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   334
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   335
-        String host = domain;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   336
-        int port = 5269;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   337
-        try {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   338
-            Attributes dnsLookup =
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   339
-                    context.getAttributes("_xmpp-server._tcp." + domain, new String[]{"SRV"});
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   340
-            String srvRecord = (String)dnsLookup.get("SRV").get();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   341
-            String [] srvRecordEntries = srvRecord.split(" ");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   342
-            port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   343
-            host = srvRecordEntries[srvRecordEntries.length-1];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   344
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   345
-        catch (Exception e) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   346
-            // Attempt lookup with older "jabber" name.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   347
-            try {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   348
-                Attributes dnsLookup =
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   349
-                        context.getAttributes("_jabber._tcp." + domain, new String[]{"SRV"});
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   350
-                String srvRecord = (String)dnsLookup.get("SRV").get();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   351
-                String [] srvRecordEntries = srvRecord.split(" ");
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   352
-                port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   353
-                host = srvRecordEntries[srvRecordEntries.length-1];
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   354
-            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   355
-            catch (Exception e2) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   356
-                // Ignore.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   357
-            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   358
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   359
-        // Host entries in DNS should end with a ".".
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   360
-        if (host.endsWith(".")) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   361
-            host = host.substring(0, host.length()-1);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   362
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   363
-        HostAddress address = new HostAddress(host, port);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   364
-        // Add item to cache.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   365
-        cache.put(key, address);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   366
-        return address;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   367
     }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   368
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   369
     /**
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   370
@@ -253,4 +151,4 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   371
             return port == address.port;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   372
         }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   373
     }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   374
-}
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   375
\ No newline at end of file
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   376
+}
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   377
Index: source/org/jivesoftware/smack/util/PacketParserUtils.java
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   378
===================================================================
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   379
--- source/org/jivesoftware/smack/util/PacketParserUtils.java	(révision 10982)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   380
+++ source/org/jivesoftware/smack/util/PacketParserUtils.java	(copie de travail)
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   381
@@ -25,7 +25,7 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   382
 import org.jivesoftware.smack.provider.ProviderManager;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   383
 import org.xmlpull.v1.XmlPullParser;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   384
 
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   385
-import java.beans.PropertyDescriptor;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   386
+//import java.beans.PropertyDescriptor;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   387
 import java.io.ByteArrayInputStream;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   388
 import java.io.ObjectInputStream;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   389
 import java.util.ArrayList;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   390
@@ -428,26 +428,26 @@
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   391
     {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   392
         boolean done = false;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   393
         Object object = objectClass.newInstance();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   394
-        while (!done) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   395
-            int eventType = parser.next();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   396
-            if (eventType == XmlPullParser.START_TAG) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   397
-                String name = parser.getName();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   398
-                String stringValue = parser.nextText();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   399
-                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   400
-                // Load the class type of the property.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   401
-                Class propertyType = descriptor.getPropertyType();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   402
-                // Get the value of the property by converting it from a
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   403
-                // String to the correct object type.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   404
-                Object value = decode(propertyType, stringValue);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   405
-                // Set the value of the bean.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   406
-                descriptor.getWriteMethod().invoke(object, value);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   407
-            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   408
-            else if (eventType == XmlPullParser.END_TAG) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   409
-                if (parser.getName().equals(elementName)) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   410
-                    done = true;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   411
-                }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   412
-            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   413
-        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   414
+//        while (!done) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   415
+//            int eventType = parser.next();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   416
+//            if (eventType == XmlPullParser.START_TAG) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   417
+//                String name = parser.getName();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   418
+//                String stringValue = parser.nextText();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   419
+//                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   420
+//                // Load the class type of the property.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   421
+//                Class propertyType = descriptor.getPropertyType();
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   422
+//                // Get the value of the property by converting it from a
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   423
+//                // String to the correct object type.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   424
+//                Object value = decode(propertyType, stringValue);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   425
+//                // Set the value of the bean.
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   426
+//                descriptor.getWriteMethod().invoke(object, value);
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   427
+//            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   428
+//            else if (eventType == XmlPullParser.END_TAG) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   429
+//                if (parser.getName().equals(elementName)) {
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   430
+//                    done = true;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   431
+//                }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   432
+//            }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   433
+//        }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   434
         return object;
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   435
     }
213b84d2e743 Improve the service. It connect with a xmpp server running on the
Da Risk <darisk972@gmail.com>
parents:
diff changeset
   436