aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/http/www/NewMessage.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/http/www/NewMessage.java')
-rw-r--r--src/main/java/com/juick/http/www/NewMessage.java61
1 files changed, 30 insertions, 31 deletions
diff --git a/src/main/java/com/juick/http/www/NewMessage.java b/src/main/java/com/juick/http/www/NewMessage.java
index 4d4ffde6..b3b63b17 100644
--- a/src/main/java/com/juick/http/www/NewMessage.java
+++ b/src/main/java/com/juick/http/www/NewMessage.java
@@ -31,6 +31,7 @@ import com.juick.xmpp.extensions.JuickUser;
import com.juick.xmpp.extensions.Nickname;
import com.juick.xmpp.extensions.XOOB;
import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import java.io.IOException;
import java.io.PrintWriter;
@@ -214,33 +215,32 @@ public class NewMessage {
xoob.URL = attachmentURL;
xmsg.addChild(xoob);
}
- if (xmpp != null) {
- String tagsStr2 = "";
- for (String tag : tagsArr) {
- tagsStr2 += " *" + tag;
- }
- xmsg.body = "@" + jmsg.getUser().getUName() + ":" + tagsStr2 + "\n" + body + "\n\n#" + mid + " http://juick.com/" + mid;
-
- xmsg.to = new JID("juick", "s2s.juick.com", null);
- xmpp.send(xmsg);
+ String tagsStr2 = "";
+ for (String tag : tagsArr) {
+ tagsStr2 += " *" + tag;
+ }
+ xmsg.body = "@" + jmsg.getUser().getUName() + ":" + tagsStr2 + "\n" + body + "\n\n#" + mid + " http://juick.com/" + mid;
- xmsg.to.Host = "ws.juick.com";
- xmpp.send(xmsg);
+ xmsg.to = new JID("juick", "s2s.juick.com", null);
+ Main.push(xmsg);
- xmsg.to.Host = "push.juick.com";
- xmpp.send(xmsg);
+ xmsg.to.Host = "push.juick.com";
+ Main.push(xmsg);
- xmsg.to.Host = "crosspost.juick.com";
- xmsg.to.Username = "twitter";
- xmpp.send(xmsg);
- xmsg.to.Username = "fb";
- xmpp.send(xmsg);
+ xmsg.to.Host = "crosspost.juick.com";
+ xmsg.to.Username = "twitter";
+ Main.push(xmsg);
+ xmsg.to.Username = "fb";
+ Main.push(xmsg);
- xmsg.to.Host = "nologin.ru";
- xmsg.to.Username = "jubo";
+ xmsg.to.Host = "nologin.ru";
+ xmsg.to.Username = "jubo";
+ Main.push(xmsg);
+ if (xmpp != null) {
+ xmsg.to.Host = "ws.juick.com";
xmpp.send(xmsg);
} else {
- logger.warning("XMPP is not available, users will not be notified");
+ logger.warning("XMPP is not available, websockets will not be notified");
}
response.setContentType("text/html; charset=UTF-8");
@@ -375,19 +375,19 @@ public class NewMessage {
xmsg.addChild(xoob);
}
- if (xmpp != null) {
- xmsg.body = "Reply by @" + jmsg.getUser().getUName() + ":\n>" + quote + "\n" + body + "\n\n#" + mid + "/" + ridnew + " http://juick.com/" + mid + "#" + ridnew;
- xmsg.to = new JID("juick", "s2s.juick.com", null);
- xmpp.send(xmsg);
+ xmsg.body = "Reply by @" + jmsg.getUser().getUName() + ":\n>" + quote + "\n" + body + "\n\n#" + mid + "/" + ridnew + " http://juick.com/" + mid + "#" + ridnew;
- xmsg.to.Host = "ws.juick.com";
- xmpp.send(xmsg);
+ xmsg.to = new JID("juick", "s2s.juick.com", null);
+ Main.push(xmsg);
+ xmsg.to.Host = "push.juick.com";
+ Main.push(xmsg);
- xmsg.to.Host = "push.juick.com";
+ if (xmpp != null) {
+ xmsg.to.Host = "ws.juick.com";
xmpp.send(xmsg);
} else {
- logger.warning("XMPP is not available, users will not be notified");
+ logger.warning("XMPP is not available, websockets will not be notified");
}
Utils.sendTemporaryRedirect(response, "/" + msg.getUser().getUName() + "/" + mid + "#" + ridnew);
@@ -413,13 +413,12 @@ public class NewMessage {
if (res) {
Message xmsg = new Message();
- xmsg.from = new JID("juick", "juick.com", null);
xmsg.to = new JID("recomm", "s2s.juick.com", null);
JuickMessage jmsg = new JuickMessage();
jmsg.setMID(mid);
jmsg.setUser(new JuickUser(visitor));
xmsg.addChild(jmsg);
- xmpp.send(xmsg);
+ Main.push(xmsg);
Utils.replyJSON(request, response, "{\"status\":\"ok\"}");
} else {