Don’t check for Sones but for their IDs.
[Sone.git] / src / main / java / net / pterodactylus / sone / template / SoneAccessor.java
index 60e2e9b..a9ee78b 100644 (file)
@@ -65,19 +65,18 @@ public class SoneAccessor extends ReflectionAccessor {
                Sone sone = (Sone) object;
                if (member.equals("niceName")) {
                        return getNiceName(sone);
+               } else if (member.equals("local")) {
+                       return sone.getInsertUri() != null;
                } else if (member.equals("friend")) {
                        Sone currentSone = (Sone) dataProvider.getData("currentSone");
-                       return (currentSone != null) && currentSone.hasFriend(sone);
+                       return (currentSone != null) && currentSone.hasFriend(sone.getId());
                } else if (member.equals("current")) {
                        Sone currentSone = (Sone) dataProvider.getData("currentSone");
                        return (currentSone != null) && currentSone.equals(sone);
-               } else if (member.equals("blocked")) {
-                       Sone currentSone = (Sone) dataProvider.getData("currentSone");
-                       return (currentSone != null) && currentSone.isSoneBlocked(sone.getId());
                } else if (member.equals("modified")) {
                        return sone.getModificationCounter() > 0;
                } else if (member.equals("status")) {
-                       return core.getSoneStatus(sone).toString();
+                       return core.getSoneStatus(sone);
                } else if (member.equals("unknown")) {
                        return core.getSoneStatus(sone) == SoneStatus.unknown;
                } else if (member.equals("idle")) {
@@ -86,6 +85,8 @@ public class SoneAccessor extends ReflectionAccessor {
                        return core.getSoneStatus(sone) == SoneStatus.inserting;
                } else if (member.equals("downloading")) {
                        return core.getSoneStatus(sone) == SoneStatus.downloading;
+               } else if (member.equals("new")) {
+                       return core.isNewSone(sone);
                }
                return super.get(dataProvider, object, member);
        }
@@ -108,7 +109,7 @@ public class SoneAccessor extends ReflectionAccessor {
                String lastName = profile.getLastName();
                if (firstName == null) {
                        if (lastName == null) {
-                               return sone.getName();
+                               return String.valueOf(sone.getName());
                        }
                        return lastName;
                }