diff options
author | Vitaly Takmazov | 2017-01-13 17:03:26 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-01-13 17:03:26 +0300 |
commit | acef82fecd92aec828a05fabc1fb29da7a645d33 (patch) | |
tree | 691caa72b6d999422cceb5972992a2a695670ba9 /juick-api/src/main/java/com/juick/api/controllers | |
parent | 98658ebab12286a56a7a018ba6a92026533dde7c (diff) |
juick-crosspost: xmpp -> ws
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/controllers')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/controllers/Messages.java | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java index d50620ff..584ff3cf 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java @@ -1,9 +1,9 @@ package com.juick.api.controllers; +import com.juick.Status; import com.juick.Tag; import com.juick.User; import com.juick.api.ApiServer; -import com.juick.Status; import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.HttpForbiddenException; import com.juick.service.MessagesService; @@ -16,13 +16,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; -import rocks.xmpp.addr.Jid; -import rocks.xmpp.core.stanza.model.Message; +import org.springframework.web.bind.annotation.*; import javax.inject.Inject; import java.util.Collections; @@ -178,31 +172,7 @@ public class Messages { @RequestParam(defaultValue = "0") int mid, @RequestParam(defaultValue = "0") int popular) { if (mid > 0) { - boolean ret = messagesService.setMessagePopular(mid, popular); - - if (ret && popular == 2) { - try { - com.juick.Message m = messagesService.getMessage(mid); - if (m != null) { - Message msg = new Message(); - msg.setFrom(Jid.of("juick@juick.com")); - msg.setTo(Jid.of("crosspost.juick.com")); - m.setUser(userService.getUserByUID(11574).get()); - msg.addExtension(m); - - msg.setTo(Jid.of("twitter@crosspost.juick.com")); - apiServer.getXmpp().send(msg); - msg.setTo(Jid.of("fb@crosspost.juick.com")); - apiServer.getXmpp().send(msg); - msg.setTo(Jid.of("vk@crosspost.juick.com")); - apiServer.getXmpp().send(msg); - } else { - throw new Exception("Message not found"); - } - } catch (Exception e) { - logger.error("SETPOPULAR ERROR", e); - } - } + messagesService.setMessagePopular(mid, popular); return Status.OK; } throw new HttpBadRequestException(); |