diff options
author | Vitaly Takmazov | 2016-01-14 12:16:49 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-01-14 12:16:49 +0300 |
commit | c492429b25c1ef711620a4f509975c7edc3ffa4a (patch) | |
tree | 5bc6b5746381d970760cd6ae5c5561e66a1f95e7 /src/main/java/com/juick/CrosspostComponent.java | |
parent | 7e93e142b6dd75c22c057962447eec014c4e15b4 (diff) |
Update libraries and refactoring
Diffstat (limited to 'src/main/java/com/juick/CrosspostComponent.java')
-rw-r--r-- | src/main/java/com/juick/CrosspostComponent.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/java/com/juick/CrosspostComponent.java b/src/main/java/com/juick/CrosspostComponent.java index f6d830ec..7fd50564 100644 --- a/src/main/java/com/juick/CrosspostComponent.java +++ b/src/main/java/com/juick/CrosspostComponent.java @@ -159,7 +159,7 @@ public class CrosspostComponent implements ServletContextListener, Stream.Strea @Override public void onMessage(com.juick.xmpp.Message msg) { JuickMessage jmsg = (JuickMessage) msg.getChild(JuickMessage.XMLNS); - if (msg.to != null && msg.to.Username != null && jmsg != null && jmsg.RID == 0) { + if (msg.to != null && msg.to.Username != null && jmsg != null && jmsg.getRID() == 0) { if (msg.to.Username.equals("twitter")) { twitterPost(jmsg); } else if (msg.to.Username.equals("fb")) { @@ -171,18 +171,18 @@ public class CrosspostComponent implements ServletContextListener, Stream.Strea } public boolean facebookPost(com.juick.Message jmsg) { - String token = CrosspostQueries.getFacebookToken(sql, jmsg.User.UID); + String token = CrosspostQueries.getFacebookToken(sql, jmsg.getUser().getUID()); if (token == null) { return false; } - logger.info("FB: #" + jmsg.MID); + logger.info("FB: #" + jmsg.getMID()); - String status = getMessageHashTags(jmsg) + "\n" + jmsg.Text; + String status = getMessageHashTags(jmsg) + "\n" + jmsg.getText(); boolean ret = false; try { - String body = "access_token=" + URLEncoder.encode(token, "UTF-8") + "&message=" + URLEncoder.encode(status, "UTF-8") + "&link=http%3A%2F%2Fjuick.com%2F" + jmsg.MID; + String body = "access_token=" + URLEncoder.encode(token, "UTF-8") + "&message=" + URLEncoder.encode(status, "UTF-8") + "&link=http%3A%2F%2Fjuick.com%2F" + jmsg.getMID(); HttpsURLConnection conn = (HttpsURLConnection) new URL(FBURL).openConnection(); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); @@ -208,14 +208,14 @@ public class CrosspostComponent implements ServletContextListener, Stream.Strea } public boolean vkontaktePost(com.juick.Message jmsg) { - String tokens[] = CrosspostQueries.getVKTokens(sql, jmsg.User.UID); + String tokens[] = CrosspostQueries.getVKTokens(sql, jmsg.getUser().getUID()); if (tokens == null || tokens.length != 2) { return false; } - logger.info("VK: #" + jmsg.MID); + logger.info("VK: #" + jmsg.getMID()); - String status = getMessageHashTags(jmsg) + "\n" + jmsg.Text + "\nhttp://juick.com/" + jmsg.MID; + String status = getMessageHashTags(jmsg) + "\n" + jmsg.getText() + "\nhttp://juick.com/" + jmsg.getMID(); boolean ret = false; try { @@ -245,20 +245,20 @@ public class CrosspostComponent implements ServletContextListener, Stream.Strea } public boolean twitterPost(com.juick.Message jmsg) { - String tokens[] = CrosspostQueries.getTwitterTokens(sql, jmsg.User.UID); + String tokens[] = CrosspostQueries.getTwitterTokens(sql, jmsg.getUser().getUID()); if (tokens == null || tokens.length != 2) { return false; } String token = percentEncode(tokens[0]); String token_secret = percentEncode(tokens[1]); - logger.info("TWITTER: #" + jmsg.MID); + logger.info("TWITTER: #" + jmsg.getMID()); - String status = getMessageHashTags(jmsg) + jmsg.Text; + String status = getMessageHashTags(jmsg) + jmsg.getText(); if (status.length() > 115) { status = status.substring(0, 114) + "…"; } - status += " http://juick.com/" + jmsg.MID; + status += " http://juick.com/" + jmsg.getMID(); status = percentEncode(status); boolean ret = false; |