From da87cd7b2df768b960cbcfbf5365b55818a94c0f Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 9 May 2016 15:57:52 +0300 Subject: comment pushes --- src/main/java/com/juick/PushComponent.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/juick/PushComponent.java b/src/main/java/com/juick/PushComponent.java index 688f1cdd..bb39496f 100644 --- a/src/main/java/com/juick/PushComponent.java +++ b/src/main/java/com/juick/PushComponent.java @@ -50,10 +50,7 @@ import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import java.io.IOException; import java.net.Socket; -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.SQLException; +import java.sql.*; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -170,14 +167,9 @@ public class PushComponent implements ServletContextListener, Stream.StreamListe boolean isPM = jmsg.getMID() == 0; boolean isReply = jmsg.getRID() > 0; int senderID = 0, recipientID = 0; - // reply pushed to original sender if (isReply) { com.juick.Message op = MessagesQueries.getMessage(sql, jmsg.getMID()); senderID = op.getUser().getUID(); - // do not notify self - if (jmsg.getUser().getUID() == op.getUser().getUID()) { - return; - } } if (isPM) { // PM @@ -198,7 +190,7 @@ public class PushComponent implements ServletContextListener, Stream.StreamListe regids.add(targetId); } } else { - regids = PushQueries.getAndroidSubscribers(sql, senderID); + regids = isReply ? PushQueries.getAndroidSubscribersToComments(sql, jmsg.getMID(), senderID) : PushQueries.getAndroidSubscribers(sql, senderID); } if (!regids.isEmpty()) { @@ -230,7 +222,7 @@ public class PushComponent implements ServletContextListener, Stream.StreamListe urls.add(targetURL); } } else { - urls = PushQueries.getWinPhoneSubscribers(sql, senderID); + urls = isReply ? PushQueries.getWindowsSubscribersToComments(sql, jmsg.getMID(), senderID) :PushQueries.getWinPhoneSubscribers(sql, senderID); } @@ -276,7 +268,7 @@ public class PushComponent implements ServletContextListener, Stream.StreamListe tokens.add(targetToken); } } else { - tokens = PushQueries.getAPNSSubscribers(sql, senderID); + tokens = isReply ? PushQueries.getAppleSubscribersToComments(sql, jmsg.getMID(), senderID) : PushQueries.getAPNSSubscribers(sql, senderID); } if (!tokens.isEmpty()) { ApnsService service = APNS.newService().withCert("/etc/juick/ios.p12", "juick") -- cgit v1.2.3