From 45de2cb240da0d3ac4f3cca6527e6b6f77d6a9c3 Mon Sep 17 00:00:00 2001 From: Andrew Shaw Date: Fri, 17 Feb 2012 17:22:46 -0800 Subject: [PATCH] unsetting c2dm on server when user or token doesn't match --- .../com/timsu/astrid/C2DMReceiver.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java b/astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java index eb27171fd..365ec3656 100644 --- a/astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java +++ b/astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java @@ -192,6 +192,25 @@ public class C2DMReceiver extends BroadcastReceiver { Intent notifyIntent = null; int notifId; + final long user_id = intent.getLongExtra("oid", -2L); + final String token_id = intent.getStringExtra("tid"); + // unregister + if (!actFmPreferenceService.isLoggedIn() || user_id != ActFmPreferenceService.userId()) { + + new Thread() { + @Override + public void run() { + try { + actFmSyncService.invoke("user_unset_c2dm", "tid", token_id, "oid", user_id); + } catch (IOException e) { + // + } + } + }.start(); + return; + } + + // fetch data if(intent.hasExtra("tag_id")) { notifyIntent = createTagIntent(context, intent);