[livejournal] r21316: LJSUP-9803: Push-notifications (WP7)
Committer: sbelyaev
LJSUP-9803: Push-notifications (WP7)U trunk/cgi-bin/LJ/Event/UserMessageRecvd.pm
Modified: trunk/cgi-bin/LJ/Event/UserMessageRecvd.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/UserMessageRecvd.pm 2012-03-07 09:21:49 UTC (rev 21315)
+++ trunk/cgi-bin/LJ/Event/UserMessageRecvd.pm 2012-03-07 09:29:35 UTC (rev 21316)
@@ -201,13 +201,26 @@
sub as_push {
my $self = shift;
my $u = shift;
+ my %opts = @_;
+
+ if (exists $opts{'message'}) {
+ my $msg = $self->load_message;
+ return $msg->body;
+ }
return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.usermessagerecvd", 1, {
user => $self->load_message->other_u->{user},
})
}
-sub as_push_payload { '"t":9,"m":'.shift->arg1 }
+sub as_push_payload {
+ my $self = shift;
+ my $os = shift;
+ if ($os eq 'wp7') {
+ return "?m=". $self->arg1;
+ }
+ return '"t":9,"m":'.$self->arg1;
+}
sub subscription_as_html {
my ($class, $subscr) = @_;
