aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src')
-rw-r--r--juick-www/src/main/java/com/juick/www/Main.java8
-rw-r--r--juick-www/src/main/java/com/juick/www/NewMessage.java6
-rw-r--r--juick-www/src/main/java/com/juick/www/PM.java2
3 files changed, 11 insertions, 5 deletions
diff --git a/juick-www/src/main/java/com/juick/www/Main.java b/juick-www/src/main/java/com/juick/www/Main.java
index e8d53e51e..56b886c9f 100644
--- a/juick-www/src/main/java/com/juick/www/Main.java
+++ b/juick-www/src/main/java/com/juick/www/Main.java
@@ -35,6 +35,7 @@ import java.io.IOException;
import java.net.ConnectException;
import java.net.Socket;
import java.net.URLEncoder;
+import java.util.Objects;
import java.util.Properties;
/**
@@ -86,7 +87,12 @@ public class Main extends HttpServlet implements Stream.StreamListener {
conf.getProperty("twitter_consumer_secret"));
pagesNewMessage = new NewMessage(conf.getProperty("upload_tmp_dir", "/var/www/juick.com/i/tmp/"),
conf.getProperty("img_path", "/var/www/juick.com/i/"));
- PageTemplates.sape = new Sape(conf.getProperty("sape_user"), "juick.com", 2000, 3600);
+ String sapeUser = conf.getProperty("sape_user", "");
+ if (!Objects.equals(sapeUser, "")) {
+ PageTemplates.sape = new Sape(sapeUser, "juick.com", 2000, 3600);
+ } else {
+ log("Sape is not initialized");
+ }
} catch (Exception e) {
log(null, e);
}
diff --git a/juick-www/src/main/java/com/juick/www/NewMessage.java b/juick-www/src/main/java/com/juick/www/NewMessage.java
index 8efec54c0..d48679990 100644
--- a/juick-www/src/main/java/com/juick/www/NewMessage.java
+++ b/juick-www/src/main/java/com/juick/www/NewMessage.java
@@ -228,7 +228,7 @@ public class NewMessage {
xoob.URL = attachmentURL;
xmsg.addChild(xoob);
}
- if (xmpp.isLoggedIn()) {
+ if (xmpp != null) {
String tagsStr2 = "";
for (String tag : tagsArr) {
@@ -399,7 +399,7 @@ public class NewMessage {
xmsg.addChild(xoob);
}
- if (xmpp.isLoggedIn()) {
+ if (xmpp != null) {
xmsg.body = "Reply by @" + jmsg.getUser().getUName() + ":\n>" + quote + "\n" + body + "\n\n#" + mid + "/" + ridnew + " http://juick.com/" + mid + "#" + ridnew;
@@ -437,7 +437,7 @@ public class NewMessage {
boolean res = MessagesQueries.recommendMessage(sql, mid, visitor.getUID());
if (res) {
- if (xmpp.isLoggedIn()) {
+ if (xmpp != null) {
Message xmsg = new Message();
xmsg.from = new JID("juick", "juick.com", null);
xmsg.to = new JID("recomm", "s2s.juick.com", null);
diff --git a/juick-www/src/main/java/com/juick/www/PM.java b/juick-www/src/main/java/com/juick/www/PM.java
index ee1d71405..af5b73a4d 100644
--- a/juick-www/src/main/java/com/juick/www/PM.java
+++ b/juick-www/src/main/java/com/juick/www/PM.java
@@ -191,7 +191,7 @@ public class PM {
}
if (PMQueries.createPM(sql, visitor.getUID(), uid, body)) {
- if (xmpp.isLoggedIn()) {
+ if (xmpp != null) {
Message msg = new Message();
msg.from = new JID("juick", "juick.com", null);
msg.to = new JID(Integer.toString(uid), "push.juick.com", null);