Author: remi
Date: 2009-02-17 17:23:33 +0100 (Tue, 17 Feb 2009)
New Revision: 3721

Modified:
   
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/IPN/IPNServer.py
Log:
* IPNServer can now notifying a specific client

Modified: 
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/IPN/IPNServer.py
===================================================================
--- 
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/IPN/IPNServer.py
    2009-02-17 15:50:27 UTC (rev 3720)
+++ 
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/IPN/IPNServer.py
    2009-02-17 16:23:33 UTC (rev 3721)
@@ -380,10 +380,11 @@
     # 
--------------------------------------------------------------------------
     # Send a message to the connected clients.
     # 
--------------------------------------------------------------------------
-    def notify(self, message):
+    def notify(self, message, idClient = None):
         """Send a message to the connected clients.
         @param message: Message to notify. The maximal size of a message is 127
                         characters.
+        @param idClient: Id of the client to notify or None for all clients.
         """
         # Regularize the message length (0 > correct size < 128)
         if len(message) > 127:
@@ -393,10 +394,14 @@
         message = message + "\n" + "".join(" " * (127 - len(message)))
         self.__logger.logDebug("Notified : (%s)" % message)
         self.__cliMutex.acquire()
-        # Send the message to all registered clients
+        # Send the message to the clients
         for cli in self.__cliLst:
             try:
-                cli['connection'].send(message)
+                if idClient == None:
+                    cli['connection'].send(message)
+                else:
+                    if cli['id'] == idClient:
+                        cli['connection'].send(message)
             except:
                 # No special action if the client connection is broken, it will
                 # be removed by the "ping" loop


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to