Author: NeX
Date: 2010-03-17 21:24:29 +0100 (Wed, 17 Mar 2010)
New Revision: 28592

Modified:
   
plugins/sfApplePushNotificationServicePlugin/trunk/lib/connections/ApnConnection.class.php
   
plugins/sfApplePushNotificationServicePlugin/trunk/lib/task/apnListenNotificationsQueueTask.class.php
Log:
Added custom message

Modified: 
plugins/sfApplePushNotificationServicePlugin/trunk/lib/connections/ApnConnection.class.php
===================================================================
--- 
plugins/sfApplePushNotificationServicePlugin/trunk/lib/connections/ApnConnection.class.php
  2010-03-17 20:05:29 UTC (rev 28591)
+++ 
plugins/sfApplePushNotificationServicePlugin/trunk/lib/connections/ApnConnection.class.php
  2010-03-17 20:24:29 UTC (rev 28592)
@@ -28,4 +28,11 @@
         $message = chr(0) . pack("n",32) . pack('H*', str_replace(' ', '', 
$token)) . pack("n",strlen($payload)) . $payload;
         fwrite($this->connection, $message);
     }
+    
+    function customSend($token, $aps) {
+       $body = array('aps' => $aps);
+       $payload = json_encode($body);
+        $message = chr(0) . pack("n",32) . pack('H*', str_replace(' ', '', 
$token)) . pack("n",strlen($payload)) . $payload;
+        fwrite($this->connection, $message);
+    }
 } 

Modified: 
plugins/sfApplePushNotificationServicePlugin/trunk/lib/task/apnListenNotificationsQueueTask.class.php
===================================================================
--- 
plugins/sfApplePushNotificationServicePlugin/trunk/lib/task/apnListenNotificationsQueueTask.class.php
       2010-03-17 20:05:29 UTC (rev 28591)
+++ 
plugins/sfApplePushNotificationServicePlugin/trunk/lib/task/apnListenNotificationsQueueTask.class.php
       2010-03-17 20:24:29 UTC (rev 28592)
@@ -48,7 +48,11 @@
         if($queue_item = $queue_connection->readMessage()){
             $apn_connection = new ApnConecction();
             $apn_connection->connect();
-            $apn_connection->send($queue_item['token'], 
$queue_item['message']);
+            if(isset($queue_item['custom_content'])) {
+               $apn_connection->customSend($queue_item['token'], 
$queue_item['custom_content']);
+            } else {
+               $apn_connection->send($queue_item['token'], 
$queue_item['message']);
+            }
             $apn_connection->disconnect();
         }
         $queue_connection->disconnect();

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to