diff options
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/Messages.java')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/Messages.java | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/juick-api/src/main/java/com/juick/api/Messages.java b/juick-api/src/main/java/com/juick/api/Messages.java index de845d45..93abb06b 100644 --- a/juick-api/src/main/java/com/juick/api/Messages.java +++ b/juick-api/src/main/java/com/juick/api/Messages.java @@ -7,15 +7,14 @@ import com.juick.json.MessageSerializer; import com.juick.server.MessagesQueries; import com.juick.server.TagQueries; import com.juick.server.UserQueries; -import com.juick.xmpp.JID; -import com.juick.xmpp.Message; -import com.juick.xmpp.Stream; -import com.juick.xmpp.extensions.JuickMessage; import org.apache.commons.lang3.math.NumberUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.util.StringUtils; +import rocks.xmpp.addr.Jid; +import rocks.xmpp.core.session.XmppSession; +import rocks.xmpp.core.stanza.model.Message; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -140,7 +139,7 @@ public class Messages { } public void doSetPrivacy(HttpServletRequest request, - HttpServletResponse response, Stream xmpp, int vuid) + HttpServletResponse response, XmppSession xmpp, int vuid) throws ServletException, IOException { int mid = NumberUtils.toInt(request.getParameter("mid"), 0); com.juick.User user = MessagesQueries.getMessageAuthor(sql, mid); @@ -152,7 +151,7 @@ public class Messages { } public void doSetPopular(HttpServletRequest request, - HttpServletResponse response, Stream xmpp) + HttpServletResponse response, XmppSession xmpp) throws ServletException, IOException { int mid = NumberUtils.toInt(request.getParameter("mid"), 0); int popular = NumberUtils.toInt(request.getParameter("popular"), 0); @@ -165,17 +164,16 @@ public class Messages { com.juick.Message m = MessagesQueries.getMessage(sql, mid); if (m != null) { Message msg = new Message(); - msg.from = new JID("juick", "juick.com", null); - msg.to = new JID(null, "crosspost.juick.com", null); - JuickMessage jmsg = new JuickMessage(m); - jmsg.setUser(UserQueries.getUserByUID(sql, 11574).get()); - msg.childs.add(jmsg); + msg.setFrom(Jid.of("juick@juick.com")); + msg.setTo(Jid.of("crosspost.juick.com")); + m.setUser(UserQueries.getUserByUID(sql, 11574).get()); + msg.addExtension(m); - msg.to.Username = "twitter"; + msg.setTo(Jid.of("twitter@crosspost.juick.com")); xmpp.send(msg); - msg.to.Username = "fb"; + msg.setTo(Jid.of("fb@crosspost.juick.com")); xmpp.send(msg); - msg.to.Username = "vk"; + msg.setTo(Jid.of("vk@crosspost.juick.com")); xmpp.send(msg); } else { throw new Exception("Message not found"); |