From 51d9de02265d6cc9d6045d79497d2a987ae2f7f7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 15 Nov 2016 14:21:27 +0300 Subject: core classes are now serializeable with JAXB (to use as babbler extension) --- .../main/java/com/juick/components/Crosspost.java | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'juick-crosspost/src') diff --git a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java index c82fc542..8ccca67c 100644 --- a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java +++ b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java @@ -127,7 +127,7 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea @Override public void onMessage(final com.juick.xmpp.Message msg) { JuickMessage jmsg = (JuickMessage) msg.getChild(JuickMessage.XMLNS); - if (msg.to != null && msg.to.Username != null && jmsg != null && jmsg.getRID() == 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")) { @@ -139,12 +139,12 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea } public boolean facebookPost(final com.juick.Message jmsg) { - String token = crosspostService.getFacebookToken(jmsg.getUser().getUID()).orElse(""); + String token = crosspostService.getFacebookToken(jmsg.getUser().getUid()).orElse(""); if (token.isEmpty()) { return false; } - logger.info("FB: #" + jmsg.getMID()); + logger.info("FB: #" + jmsg.getMid()); String status = getMessageHashTags(jmsg) + "\n" + jmsg.getText(); @@ -155,7 +155,7 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea + "&message=" + URLEncoder.encode(status, "UTF-8") + "&link=http%3A%2F%2Fjuick.com%2F" - + jmsg.getMID(); + + jmsg.getMid(); HttpsURLConnection conn = (HttpsURLConnection) new URL(FBURL).openConnection(); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); @@ -181,14 +181,14 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea } public boolean vkontaktePost(final com.juick.Message jmsg) { - Pair tokens = crosspostService.getVkTokens(jmsg.getUser().getUID()).orElse(Pair.of("", "")); + Pair tokens = crosspostService.getVkTokens(jmsg.getUser().getUid()).orElse(Pair.of("", "")); if (tokens.getLeft().isEmpty() || tokens.getRight().isEmpty()) { return false; } - logger.info("VK: #" + jmsg.getMID()); + logger.info("VK: #" + jmsg.getMid()); - String status = getMessageHashTags(jmsg) + "\n" + jmsg.getText() + "\nhttp://juick.com/" + jmsg.getMID(); + String status = getMessageHashTags(jmsg) + "\n" + jmsg.getText() + "\nhttp://juick.com/" + jmsg.getMid(); boolean ret = false; try { @@ -218,20 +218,20 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea } public boolean twitterPost(final com.juick.Message jmsg) { - Pair tokens = crosspostService.getTwitterTokens(jmsg.getUser().getUID()).orElse(Pair.of("", "")); + Pair tokens = crosspostService.getTwitterTokens(jmsg.getUser().getUid()).orElse(Pair.of("", "")); if (tokens.getLeft().isEmpty() || tokens.getRight().isEmpty()) { return false; } String token = percentEncode(tokens.getLeft()); String token_secret = percentEncode(tokens.getRight()); - logger.info("TWITTER: #" + jmsg.getMID()); + logger.info("TWITTER: #" + jmsg.getMid()); String status = getMessageHashTags(jmsg) + jmsg.getText(); if (status.length() > 115) { status = status.substring(0, 114) + "…"; } - status += " http://juick.com/" + jmsg.getMID(); + status += " http://juick.com/" + jmsg.getMid(); status = percentEncode(status); boolean ret = false; @@ -316,8 +316,8 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea public String getMessageHashTags(final com.juick.Message jmsg) { String hashtags = ""; - for (int i = 0; i < jmsg.Tags.size(); i++) { - hashtags += "#" + jmsg.Tags.get(i) + " "; + for (int i = 0; i < jmsg.getTags().size(); i++) { + hashtags += "#" + jmsg.getTags().get(i) + " "; } return hashtags; } -- cgit v1.2.3