log.info("SubscriptionServlet: ..." + req.getPathInfo());
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
Subscription sub = xmpp.parseSubscription(req);
JID userJID = sub.getFromJid();
Entity userEntity = MainPageServlet.getUserEntity(userJID);
if (sub.getSubscriptionType() == SubscriptionType.SUBSCRIBED) {
userEntity.setProperty("accepted_invitation", true);
} else if (sub.getSubscriptionType() == SubscriptionType.UNSUBSCRIBED) {
userEntity.setProperty("accepted_invitation", false);
} else if (sub.getSubscriptionType() == SubscriptionType.SUBSCRIBE) {
userEntity.setProperty("is_subscribed", true);
} else if (sub.getSubscriptionType() == SubscriptionType.UNSUBSCRIBE) {
userEntity.setProperty("is_subscribed", false);
}
datastore.put(userEntity);
}