projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'release-0.7.2'
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
core
/
Core.java
diff --git
a/src/main/java/net/pterodactylus/sone/core/Core.java
b/src/main/java/net/pterodactylus/sone/core/Core.java
index
1c9d668
..
ee5ec87
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/Core.java
+++ b/
src/main/java/net/pterodactylus/sone/core/Core.java
@@
-38,6
+38,7
@@
import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Client;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Client;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Post;
+import net.pterodactylus.sone.data.PostReply;
import net.pterodactylus.sone.data.Profile;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.data.Profile;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
@@
-173,7
+174,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
private Set<String> knownPosts = new HashSet<String>();
/** All replies. */
private Set<String> knownPosts = new HashSet<String>();
/** All replies. */
- private Map<String,
Reply> replies = new HashMap<String,
Reply>();
+ private Map<String,
PostReply> replies = new HashMap<String, Post
Reply>();
/** All new replies. */
private Set<String> newReplies = new HashSet<String>();
/** All new replies. */
private Set<String> newReplies = new HashSet<String>();
@@
-676,7
+677,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
* The ID of the reply to get
* @return The reply
*/
* The ID of the reply to get
* @return The reply
*/
- public Reply getReply(String replyId) {
+ public
Post
Reply getReply(String replyId) {
return getReply(replyId, true);
}
return getReply(replyId, true);
}
@@
-692,11
+693,11
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
* to return {@code null} if no reply can be found
* @return The reply, or {@code null} if there is no such reply
*/
* to return {@code null} if no reply can be found
* @return The reply, or {@code null} if there is no such reply
*/
- public Reply getReply(String replyId, boolean create) {
+ public
Post
Reply getReply(String replyId, boolean create) {
synchronized (replies) {
synchronized (replies) {
- Reply reply = replies.get(replyId);
+
Post
Reply reply = replies.get(replyId);
if (create && (reply == null)) {
if (create && (reply == null)) {
- reply = new Reply(replyId);
+ reply = new
Post
Reply(replyId);
replies.put(replyId, reply);
}
return reply;
replies.put(replyId, reply);
}
return reply;
@@
-710,11
+711,11
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
* The post to get all replies for
* @return All replies for the given post
*/
* The post to get all replies for
* @return All replies for the given post
*/
- public List<Reply> getReplies(Post post) {
+ public List<
Post
Reply> getReplies(Post post) {
Set<Sone> sones = getSones();
Set<Sone> sones = getSones();
- List<
Reply> replies = new ArrayList<
Reply>();
+ List<
PostReply> replies = new ArrayList<Post
Reply>();
for (Sone sone : sones) {
for (Sone sone : sones) {
- for (Reply reply : sone.getReplies()) {
+ for (
Post
Reply reply : sone.getReplies()) {
if (reply.getPost().equals(post)) {
replies.add(reply);
}
if (reply.getPost().equals(post)) {
replies.add(reply);
}
@@
-762,7
+763,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
* The reply to get the liking Sones for
* @return The Sones that like the given reply
*/
* The reply to get the liking Sones for
* @return The Sones that like the given reply
*/
- public Set<Sone> getLikes(Reply reply) {
+ public Set<Sone> getLikes(
Post
Reply reply) {
Set<Sone> sones = new HashSet<Sone>();
for (Sone sone : getSones()) {
if (sone.getLikedReplyIds().contains(reply.getId())) {
Set<Sone> sones = new HashSet<Sone>();
for (Sone sone : getSones()) {
if (sone.getLikedReplyIds().contains(reply.getId())) {
@@
-1204,16
+1205,16
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
}
synchronized (replies) {
if (!soneRescueMode) {
}
synchronized (replies) {
if (!soneRescueMode) {
- for (Reply reply : storedSone.getReplies()) {
+ for (
Post
Reply reply : storedSone.getReplies()) {
replies.remove(reply.getId());
if (!sone.getReplies().contains(reply)) {
coreListenerManager.fireReplyRemoved(reply);
}
}
}
replies.remove(reply.getId());
if (!sone.getReplies().contains(reply)) {
coreListenerManager.fireReplyRemoved(reply);
}
}
}
- Set<Reply> storedReplies = storedSone.getReplies();
+ Set<
Post
Reply> storedReplies = storedSone.getReplies();
synchronized (newReplies) {
synchronized (newReplies) {
- for (Reply reply : sone.getReplies()) {
+ for (
Post
Reply reply : sone.getReplies()) {
reply.setSone(storedSone);
if (!storedReplies.contains(reply) && !knownReplies.contains(reply.getId())) {
newReplies.add(reply.getId());
reply.setSone(storedSone);
if (!storedReplies.contains(reply) && !knownReplies.contains(reply.getId())) {
newReplies.add(reply.getId());
@@
-1249,7
+1250,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
for (Post post : sone.getPosts()) {
storedSone.addPost(post);
}
for (Post post : sone.getPosts()) {
storedSone.addPost(post);
}
- for (Reply reply : sone.getReplies()) {
+ for (
Post
Reply reply : sone.getReplies()) {
storedSone.addReply(reply);
}
for (String likedPostId : sone.getLikedPostIds()) {
storedSone.addReply(reply);
}
for (String likedPostId : sone.getLikedPostIds()) {
@@
-1395,7
+1396,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
}
/* load replies. */
}
/* load replies. */
- Set<
Reply> replies = new HashSet<
Reply>();
+ Set<
PostReply> replies = new HashSet<Post
Reply>();
while (true) {
String replyPrefix = sonePrefix + "/Replies/" + replies.size();
String replyId = configuration.getStringValue(replyPrefix + "/ID").getValue(null);
while (true) {
String replyPrefix = sonePrefix + "/Replies/" + replies.size();
String replyId = configuration.getStringValue(replyPrefix + "/ID").getValue(null);
@@
-1528,7
+1529,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
}
}
synchronized (newReplies) {
}
}
synchronized (newReplies) {
- for (Reply reply : replies) {
+ for (
Post
Reply reply : replies) {
knownReplies.add(reply.getId());
}
}
knownReplies.add(reply.getId());
}
}
@@
-1718,7
+1719,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
* The text of the reply
* @return The created reply
*/
* The text of the reply
* @return The created reply
*/
- public Reply createReply(Sone sone, Post post, String text) {
+ public
Post
Reply createReply(Sone sone, Post post, String text) {
return createReply(sone, post, System.currentTimeMillis(), text);
}
return createReply(sone, post, System.currentTimeMillis(), text);
}
@@
-1735,12
+1736,12
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
* The text of the reply
* @return The created reply
*/
* The text of the reply
* @return The created reply
*/
- public Reply createReply(Sone sone, Post post, long time, String text) {
+ public
Post
Reply createReply(Sone sone, Post post, long time, String text) {
if (!isLocalSone(sone)) {
logger.log(Level.FINE, "Tried to create reply for non-local Sone: %s", sone);
return null;
}
if (!isLocalSone(sone)) {
logger.log(Level.FINE, "Tried to create reply for non-local Sone: %s", sone);
return null;
}
- final
Reply reply = new
Reply(sone, post, System.currentTimeMillis(), text);
+ final
PostReply reply = new Post
Reply(sone, post, System.currentTimeMillis(), text);
synchronized (replies) {
replies.put(reply.getId(), reply);
}
synchronized (replies) {
replies.put(reply.getId(), reply);
}
@@
-1769,7
+1770,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
* @param reply
* The reply to delete
*/
* @param reply
* The reply to delete
*/
- public void deleteReply(Reply reply) {
+ public void deleteReply(
Post
Reply reply) {
Sone sone = reply.getSone();
if (!isLocalSone(sone)) {
logger.log(Level.FINE, "Tried to delete non-local reply: %s", reply);
Sone sone = reply.getSone();
if (!isLocalSone(sone)) {
logger.log(Level.FINE, "Tried to delete non-local reply: %s", reply);
@@
-1793,7
+1794,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
* @param reply
* The reply to mark as known
*/
* @param reply
* The reply to mark as known
*/
- public void markReplyKnown(Reply reply) {
+ public void markReplyKnown(
Post
Reply reply) {
synchronized (newReplies) {
if (newReplies.remove(reply.getId())) {
knownReplies.add(reply.getId());
synchronized (newReplies) {
if (newReplies.remove(reply.getId())) {
knownReplies.add(reply.getId());
@@
-2064,7
+2065,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
/* save replies. */
int replyCounter = 0;
/* save replies. */
int replyCounter = 0;
- for (Reply reply : sone.getReplies()) {
+ for (
Post
Reply reply : sone.getReplies()) {
String replyPrefix = sonePrefix + "/Replies/" + replyCounter++;
configuration.getStringValue(replyPrefix + "/ID").setValue(reply.getId());
configuration.getStringValue(replyPrefix + "/Post/ID").setValue(reply.getPost().getId());
String replyPrefix = sonePrefix + "/Replies/" + replyCounter++;
configuration.getStringValue(replyPrefix + "/ID").setValue(reply.getId());
configuration.getStringValue(replyPrefix + "/Post/ID").setValue(reply.getPost().getId());
@@
-2457,7
+2458,7
@@
public class Core extends AbstractService implements IdentityListener, UpdateLis
}
synchronized (replies) {
synchronized (newReplies) {
}
synchronized (replies) {
synchronized (newReplies) {
- for (Reply reply : sone.getReplies()) {
+ for (
Post
Reply reply : sone.getReplies()) {
replies.remove(reply.getId());
newReplies.remove(reply.getId());
coreListenerManager.fireReplyRemoved(reply);
replies.remove(reply.getId());
newReplies.remove(reply.getId());
coreListenerManager.fireReplyRemoved(reply);