[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/impl/protocol/msn/

damencho at dev.java.net damencho at dev.java.net
Thu Apr 19 16:42:37 CEST 2007


User: damencho
Date: 2007-04-19 14:42:37+0000
Modified:
   sip-communicator/src/net/java/sip/communicator/impl/protocol/msn/EventManager.java
   sip-communicator/src/net/java/sip/communicator/impl/protocol/msn/ServerStoredContactListMsnImpl.java

Log:
 Msn added unregister on network fail.

File Changes:

Directory: /sip-communicator/src/net/java/sip/communicator/impl/protocol/msn/
=============================================================================

File [changed]: EventManager.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/protocol/msn/EventManager.java?r1=1.3&r2=1.4
Delta lines:  +41 -5
--------------------
--- EventManager.java	2007-03-21 13:39:29+0000	1.3
+++ EventManager.java	2007-04-19 14:42:34+0000	1.4
@@ -10,12 +10,13 @@
 
 import net.sf.jml.*;
 import net.sf.jml.impl.*;
+import net.sf.jml.net.*;
 import net.sf.jml.protocol.*;
 import net.sf.jml.protocol.incoming.*;
-import net.java.sip.communicator.util.Logger;
-import net.sf.jml.net.Message;
-import net.sf.jml.net.SessionAdapter;
-import net.sf.jml.net.SocketSession;
+import net.java.sip.communicator.util.*;
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.event.*;
+
 
 /**
  * Manager which listens for changing of the contact list
@@ -32,11 +33,18 @@
     private Vector listeners = new Vector();
 
     /**
+     * The provider that is on top of us.
+     */
+    private ProtocolProviderServiceMsnImpl msnProvider = null;
+    
+    /**
      * Creates the manager
      * @param msnMessenger BasicMessenger the messanger
      */
-    public EventManager(BasicMessenger msnMessenger)
+    public EventManager(ProtocolProviderServiceMsnImpl msnProvider, 
+        BasicMessenger msnMessenger)
     {
+        this.msnProvider = msnProvider;
         this.msnMessenger = msnMessenger;
 
         msnMessenger.addSessionListener(this);
@@ -200,6 +208,34 @@
             if(incomingOUT.isLoggingFromOtherLocation())
                 fireLoggingFromOtherLocation();
         }
+        else if(incoming instanceof IncomingQNG)
+        {
+            IncomingQNG incomingQNG  = (IncomingQNG)incoming;
+            
+            connected = true;
+        }
+    }
+    
+    private boolean connected = false;
+    private Timer connectionTimer = new Timer();
+            
+    public void sessionTimeout(SocketSession socketSession) throws Exception
+    {
+        connectionTimer.schedule(new TimerTask()
+        {
+            public void run()
+            {
+                if(!connected)
+                {
+                    msnProvider.unregister(false);
+                    msnProvider.fireRegistrationStateChanged(
+                        msnProvider.getRegistrationState(),
+                        RegistrationState.CONNECTION_FAILED,
+                        RegistrationStateChangeEvent.REASON_NOT_SPECIFIED, null);
+                }
+            }
+        }, 20000);
+        connected = false;
     }
 
     /**

File [changed]: ServerStoredContactListMsnImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/protocol/msn/ServerStoredContactListMsnImpl.java?r1=1.10&r2=1.11
Delta lines:  +2 -1
-------------------
--- ServerStoredContactListMsnImpl.java	2006-12-19 09:07:01+0000	1.10
+++ ServerStoredContactListMsnImpl.java	2007-04-19 14:42:34+0000	1.11
@@ -1194,7 +1194,8 @@
     {
         this.messenger = messenger;
 
-        contactListModManager = new EventManager((BasicMessenger)messenger);
+        contactListModManager = 
+            new EventManager(msnProvider, (BasicMessenger)messenger);
 
         contactListModManager.
             addModificationListener(contactListModListenerImpl);




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: cvs-help at sip-communicator.dev.java.net





More information about the commits mailing list