From d3424cc0a583928086afd06244acdfd21a9113f5 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 8 May 2016 13:57:48 +0300 Subject: fix ejabberd dialback --- src/main/java/com/juick/xmpp/s2s/ConnectionOut.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java index 4ebeffb6..5ef5fd3c 100644 --- a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java +++ b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java @@ -45,8 +45,8 @@ public class ConnectionOut extends Connection implements Runnable { } void sendOpenStream() throws IOException { - sendStanza(""); } @@ -64,9 +64,7 @@ public class ConnectionOut extends Connection implements Runnable { try { HostnamePort addr = DNSQueries.getServerAddress(to); socket = new Socket(InetAddress.getByName(addr.hostname), addr.port); - parser.setInput(new InputStreamReader(socket.getInputStream())); - - writer = new OutputStreamWriter(socket.getOutputStream()); + restartParser(); sendOpenStream(); @@ -78,6 +76,10 @@ public class ConnectionOut extends Connection implements Runnable { LOGGER.info("STREAM TO " + to + " " + streamID + " OPEN"); XMPPComponent.addConnectionOut(ConnectionOut.this); + boolean xmppversionnew = parser.getAttributeValue(null, "version") != null; + if (!xmppversionnew) { + processDialback(); + } while (parser.next() != XmlPullParser.END_DOCUMENT) { if (parser.getEventType() != XmlPullParser.START_TAG) { -- cgit v1.2.3 From 012552e2becc66048d9948aa43476947c5520c88 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 8 May 2016 15:52:02 +0300 Subject: drop google ad --- .../java/com/juick/http/www/PageTemplates.java | 41 ---------------------- src/main/java/com/juick/http/www/UserThread.java | 4 --- 2 files changed, 45 deletions(-) diff --git a/src/main/java/com/juick/http/www/PageTemplates.java b/src/main/java/com/juick/http/www/PageTemplates.java index 2f9c8976..ebbb4b16 100644 --- a/src/main/java/com/juick/http/www/PageTemplates.java +++ b/src/main/java/com/juick/http/www/PageTemplates.java @@ -105,43 +105,6 @@ public class PageTemplates { out.println(""); } - public static void pageYandexAd728(PrintWriter out, int YandexID) { - /* - out.println("
"); - out.println(""); - */ - out.println(""); - out.println(""); - out.println(""); - } - public static void pageHomeColumn(PrintWriter out, Connection sql, com.juick.User visitor) { pageHomeColumn(out, sql, visitor, false); } @@ -514,10 +477,6 @@ public class PageTemplates { for (int i = 0; i < msgs.size(); i++) { - if (i == 0 && YandexID > 0 && ad_mid == 0) { - pageYandexAd728(out, YandexID); - } - com.juick.Message msg = msgs.get(i); List tags = MessagesQueries.getMessageTags(sql, msg.getMID()); diff --git a/src/main/java/com/juick/http/www/UserThread.java b/src/main/java/com/juick/http/www/UserThread.java index fe5ca32f..4ee290ab 100644 --- a/src/main/java/com/juick/http/www/UserThread.java +++ b/src/main/java/com/juick/http/www/UserThread.java @@ -261,10 +261,6 @@ public class UserThread { } out.println(""); - if (replies.size() > 0) { - PageTemplates.pageYandexAd728(out, 1); - } - for (Message reply : replies) { reply.cleanupChilds(); } -- cgit v1.2.3 From da87cd7b2df768b960cbcfbf5365b55818a94c0f Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 9 May 2016 15:57:52 +0300 Subject: comment pushes --- deps/com.juick.server | 2 +- src/main/java/com/juick/PushComponent.java | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/deps/com.juick.server b/deps/com.juick.server index 96188f8d..8d05498f 160000 --- a/deps/com.juick.server +++ b/deps/com.juick.server @@ -1 +1 @@ -Subproject commit 96188f8d8a31df2474bf0eaf7a91773280ddccb6 +Subproject commit 8d05498fa4dd8891dbccd04c99030655eea17fec 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 From 133b528cf04114eb564d1d9e1598818f58a62f7c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 9 May 2016 15:59:40 +0300 Subject: 2016 --- src/main/java/com/juick/http/www/PageTemplates.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/juick/http/www/PageTemplates.java b/src/main/java/com/juick/http/www/PageTemplates.java index ebbb4b16..b4337022 100644 --- a/src/main/java/com/juick/http/www/PageTemplates.java +++ b/src/main/java/com/juick/http/www/PageTemplates.java @@ -194,7 +194,7 @@ public class PageTemplates { out.print("ВКонтакте"); out.print("Facebook"); out.println(""); - out.print("
juick.com © 2008-2015"); + out.print("
juick.com © 2008-2016"); String queryString = request.getQueryString(); String requestURI = request.getRequestURI(); -- cgit v1.2.3 From afe8a8e7c0c46ce490d0c5dd5ac67ae4b26712ed Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 9 May 2016 16:15:06 +0300 Subject: fix reply user --- src/main/java/com/juick/PushComponent.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/juick/PushComponent.java b/src/main/java/com/juick/PushComponent.java index bb39496f..386448f4 100644 --- a/src/main/java/com/juick/PushComponent.java +++ b/src/main/java/com/juick/PushComponent.java @@ -50,7 +50,10 @@ import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import java.io.IOException; import java.net.Socket; -import java.sql.*; +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -168,8 +171,7 @@ public class PushComponent implements ServletContextListener, Stream.StreamListe boolean isReply = jmsg.getRID() > 0; int senderID = 0, recipientID = 0; if (isReply) { - com.juick.Message op = MessagesQueries.getMessage(sql, jmsg.getMID()); - senderID = op.getUser().getUID(); + senderID = jmsg.getUser().getUID(); } if (isPM) { // PM -- cgit v1.2.3 From 03730f1d23fe30d29bba57f0da13c9535d1a2024 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 9 May 2016 17:08:33 +0300 Subject: fix like and reply --- src/main/java/com/juick/http/www/PageTemplates.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/juick/http/www/PageTemplates.java b/src/main/java/com/juick/http/www/PageTemplates.java index b4337022..fedb11bf 100644 --- a/src/main/java/com/juick/http/www/PageTemplates.java +++ b/src/main/java/com/juick/http/www/PageTemplates.java @@ -512,12 +512,12 @@ public class PageTemplates { } out.print("