Committer: slobin
LJSUP-9803: Push-notifications (WP7)- added almost unlimited OS-independent subscriptions
M bin/upgrading/proplists.dat
M cgi-bin/ljprotocol.pl
U trunk/bin/upgrading/proplists.dat U trunk/cgi-bin/ljprotocol.pl
Modified: trunk/bin/upgrading/proplists.dat =================================================================== --- trunk/bin/upgrading/proplists.dat 2011-11-17 11:24:33 UTC (rev 20557) +++ trunk/bin/upgrading/proplists.dat 2011-11-17 12:01:23 UTC (rev 20558) @@ -1206,27 +1206,14 @@ multihomed: 0 prettyname: ZIP code -userproplist.wp7notification_url: +userproplist.push_notification_devices: cldversion: 8 - datatype: char - des: Both tile & toast push notification url + datatype: blobchar + des: ID devices with notification channels and othwer data for push notification multihomed: 0 - prettyname: Push notification url for Windows Phone + prettyname: Storage for ID devices for push notification + indexed: 0 -userproplist.android_c2dm_data: - cldversion: 8 - datatype: char - des: Data for C2DM channel - multihomed: 0 - prettyname: Push channel data for Android - -userproplist.ios_device_token: - cldversion: 8 - datatype: char - des: device token for push notifications - multihomed: 0 - prettyname: Device token for push notification service for iOS - talkproplist.edit_time: datatype: num des: Unix time of the last edit. undef if never edited. Modified: trunk/cgi-bin/ljprotocol.pl =================================================================== --- trunk/cgi-bin/ljprotocol.pl 2011-11-17 11:24:33 UTC (rev 20557) +++ trunk/cgi-bin/ljprotocol.pl 2011-11-17 12:01:23 UTC (rev 20558) @@ -127,6 +127,7 @@ "409" => [ E_PERM, "Post too large." ], "410" => [ E_PERM, "Your trial account has expired. Posting now disabled." ], "411" => [ E_TEMP, "Action frequency limit." ], + "412" => [ E_TEMP, "Subscribe limit reached." ], # Server Errors "500" => [ E_TEMP, "Internal server error" ], @@ -4779,20 +4780,19 @@ # sub registerpush { my ($req, $err, $flags) = @_; + return undef unless authenticate($req, $err, $flags); my $u = $flags->{u}; return fail($err, 200) - unless $req->{platform} && $req->{registrationid}; + unless $u && $req->{platform} && $req->{registrationid}; - my $res = LJ::PushNotification->subscribe($u, $req); + my $res = LJ::PushNotification->subscribe($u, $req) + || return fail($err, 412); - return fail($err, 200) - unless $res; - - return { status => 'OK' }; + return { status => 'OK' } } # unregisterpush: deletes subscription on push notification and clears user prop