Fix conenct

This commit is contained in:
vshcherb 2014-05-28 18:47:28 +02:00
parent 01f2085267
commit 742c1b01bb

View file

@ -150,7 +150,7 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
for(OsMoDevice d : delta) {
if(d.getDeletedTimestamp() != 0 && d.isEnabled()) {
disconnectImpl(d);
} else if(d.isEnabled() && !d.isActive()) {
} else if(!d.isActive()) {
connectDeviceImpl(d);
}
}
@ -244,8 +244,9 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
if(obj.has("group")) {
parseGroup(obj.getJSONObject("group"), gr);
}
JSONArray arr = obj.getJSONArray(USERS);
Map<String, OsMoDevice> toDelete = new HashMap<String, OsMoDevice>(gr.users);
if (obj.has(USERS)) {
JSONArray arr = obj.getJSONArray(USERS);
for (int i = 0; i < arr.length(); i++) {
JSONObject o = (JSONObject) arr.get(i);
String tid = o.getString(GROUP_TRACKER_ID);
@ -274,6 +275,7 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
}
delta.add(device);
}
}
if(deleteUsers) {
for(OsMoDevice s : toDelete.values()) {
s.deleted = System.currentTimeMillis();