Changeset 3776 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2011-01-07T00:54:21+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/User.java
r3505 r3776 7 7 import java.util.List; 8 8 import java.util.concurrent.atomic.AtomicLong; 9 import org.openstreetmap.josm.io.MirroredInputStream; 10 import java.io.InputStreamReader; 11 import java.io.BufferedReader; 9 12 10 13 /** … … 25 28 */ 26 29 private static HashMap<Long,User> userMap = new HashMap<Long,User>(); 30 private static HashSet<Long> relicensingUsers = null; 27 31 28 32 private static long getNextLocalUid() { … … 102 106 } 103 107 108 public static void loadRelicensingInformation() { 109 relicensingUsers = new HashSet<Long>(); 110 try { 111 MirroredInputStream stream = new MirroredInputStream("http://planet.openstreetmap.org/users_agreed/users_agreed.txt"); 112 InputStreamReader r; 113 r = new InputStreamReader(stream); 114 BufferedReader reader = new BufferedReader(r); 115 String line; 116 while ((line = reader.readLine()) != null) { 117 if (line.startsWith("#")) continue; 118 try { 119 relicensingUsers.add(new Long(Long.parseLong(line.trim()))); 120 } catch (java.lang.NumberFormatException ex) { 121 } 122 } 123 stream.close(); 124 } catch (java.io.IOException ex) { 125 } 126 } 127 104 128 /** the user name */ 105 129 private final HashSet<String> names = new HashSet<String>(); 106 130 /** the user id */ 107 131 private final long uid; 132 133 public static final int STATUS_UNKNOWN = 0; 134 public static final int STATUS_AGREED = 1; 135 public static final int STATUS_NOT_AGREED = 2; 136 public static final int STATUS_AUTO_AGREED = 3; 137 138 /** 139 */ 140 public int getRelicensingStatus() { 141 if (uid >= 286582) return STATUS_AUTO_AGREED; 142 if (relicensingUsers == null) return STATUS_UNKNOWN; 143 return (relicensingUsers.contains(new Long(uid)) ? STATUS_AGREED : STATUS_NOT_AGREED); 144 } 108 145 109 146 /**
Note:
See TracChangeset
for help on using the changeset viewer.