aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-05-09 15:57:52 +0300
committerGravatar Vitaly Takmazov2016-05-09 15:57:52 +0300
commitda87cd7b2df768b960cbcfbf5365b55818a94c0f (patch)
tree133fff9d71733be6e966d901e16f9ca3049a279e /src/main/java/com/juick
parent012552e2becc66048d9948aa43476947c5520c88 (diff)
comment pushes
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/PushComponent.java16
1 files changed, 4 insertions, 12 deletions
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")