ADD: Get infomation about user's directory listing options
authorJanis Streib <janis@dogcraft.de>
Sun, 24 Aug 2014 09:31:32 +0000 (11:31 +0200)
committerJanis Streib <janis@dogcraft.de>
Sun, 24 Aug 2014 09:43:55 +0000 (11:43 +0200)
src/org/cacert/gigi/User.java

index ca1c8ff8d6dddd721a5b1c7153433a6d8e2709ef..22f76c4c5f8347e968e6d6c65b54948d8e9e3c8b 100644 (file)
@@ -7,8 +7,8 @@ import java.sql.SQLException;
 import java.util.Calendar;
 
 import org.cacert.gigi.database.DatabaseConnection;
-import org.cacert.gigi.util.Notary;
 import org.cacert.gigi.localisation.Language;
+import org.cacert.gigi.util.Notary;
 import org.cacert.gigi.util.PasswordHash;
 import org.cacert.gigi.util.PasswordStrengthChecker;
 
@@ -450,4 +450,20 @@ public class User {
     public Language getPrefferedLanguage() {
         return Language.getInstance("de");
     }
+
+    public boolean wantsDirectoryListing() throws SQLException {
+        PreparedStatement get = DatabaseConnection.getInstance().prepare("SELECT listme FROM users WHERE id=?");
+        get.setInt(1, getId());
+        ResultSet exec = get.executeQuery();
+        exec.next();
+        return exec.getBoolean("listme");
+    }
+
+    public String getContactInformation() throws SQLException {
+        PreparedStatement get = DatabaseConnection.getInstance().prepare("SELECT contactinfo FROM users WHERE id=?");
+        get.setInt(1, getId());
+        ResultSet exec = get.executeQuery();
+        exec.next();
+        return exec.getString("contactinfo");
+    }
 }