diff --git a/res/values/strings.xml b/res/values/strings.xml index 9e3997e09..1b14b92bd 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -284,7 +284,7 @@ Received updated but unknown identity information. Tap to validate identity. Secure session ended. - + Left the group... Secure session ended. diff --git a/src/org/thoughtcrime/securesms/GroupCreateActivity.java b/src/org/thoughtcrime/securesms/GroupCreateActivity.java index 6263a7e7a..0303d0d82 100644 --- a/src/org/thoughtcrime/securesms/GroupCreateActivity.java +++ b/src/org/thoughtcrime/securesms/GroupCreateActivity.java @@ -670,7 +670,7 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv existingAvatarBmp = BitmapUtil.getCircleCroppedBitmap( BitmapFactory.decodeByteArray(existingAvatar, 0, existingAvatar.length)); } - return (group.getOwner() != null && group.getOwner().equals(TextSecurePreferences.getLocalNumber(GroupCreateActivity.this))); + return true; } return null; } diff --git a/src/org/thoughtcrime/securesms/database/DatabaseFactory.java b/src/org/thoughtcrime/securesms/database/DatabaseFactory.java index 6bd9daacf..2b1527dd2 100644 --- a/src/org/thoughtcrime/securesms/database/DatabaseFactory.java +++ b/src/org/thoughtcrime/securesms/database/DatabaseFactory.java @@ -642,7 +642,7 @@ public class DatabaseFactory { } if (oldVersion < INTRODUCED_GROUP_DATABASE_VERSION) { - db.execSQL("CREATE TABLE groups (_id INTEGER PRIMARY KEY, group_id TEXT, owner TEXT, title TEXT, members TEXT, avatar BLOB, avatar_id INTEGER, avatar_key BLOB, avatar_content_type TEXT, avatar_relay TEXT, timestamp INTEGER, active INTEGER DEFAULT 1);"); + db.execSQL("CREATE TABLE groups (_id INTEGER PRIMARY KEY, group_id TEXT, title TEXT, members TEXT, avatar BLOB, avatar_id INTEGER, avatar_key BLOB, avatar_content_type TEXT, avatar_relay TEXT, timestamp INTEGER, active INTEGER DEFAULT 1);"); db.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS group_id_index ON groups (GROUP_ID);"); db.execSQL("ALTER TABLE push ADD COLUMN device_id INTEGER DEFAULT 1;"); db.execSQL("ALTER TABLE sms ADD COLUMN address_device_id INTEGER DEFAULT 1;"); diff --git a/src/org/thoughtcrime/securesms/database/GroupDatabase.java b/src/org/thoughtcrime/securesms/database/GroupDatabase.java index f843868b0..374d9a297 100644 --- a/src/org/thoughtcrime/securesms/database/GroupDatabase.java +++ b/src/org/thoughtcrime/securesms/database/GroupDatabase.java @@ -31,7 +31,6 @@ public class GroupDatabase extends Database { private static final String TABLE_NAME = "groups"; private static final String ID = "_id"; private static final String GROUP_ID = "group_id"; - private static final String OWNER = "owner"; private static final String TITLE = "title"; private static final String MEMBERS = "members"; private static final String AVATAR = "avatar"; @@ -46,7 +45,6 @@ public class GroupDatabase extends Database { "CREATE TABLE " + TABLE_NAME + " (" + ID + " INTEGER PRIMARY KEY, " + GROUP_ID + " TEXT, " + - OWNER + " TEXT, " + TITLE + " TEXT, " + MEMBERS + " TEXT, " + AVATAR + " BLOB, " + @@ -112,7 +110,6 @@ public class GroupDatabase extends Database { ContentValues contentValues = new ContentValues(); contentValues.put(GROUP_ID, GroupUtil.getEncodedId(groupId)); - contentValues.put(OWNER, owner); contentValues.put(TITLE, title); contentValues.put(MEMBERS, Util.join(filteredMembers, ",")); @@ -129,7 +126,7 @@ public class GroupDatabase extends Database { databaseHelper.getWritableDatabase().insert(TABLE_NAME, null, contentValues); } - public void update(byte[] groupId, String source, String title, AttachmentPointer avatar) { + public void update(byte[] groupId, String title, AttachmentPointer avatar) { ContentValues contentValues = new ContentValues(); if (title != null) contentValues.put(TITLE, title); @@ -140,8 +137,8 @@ public class GroupDatabase extends Database { } databaseHelper.getWritableDatabase().update(TABLE_NAME, contentValues, - GROUP_ID + " = ? AND " + OWNER + " = ?", - new String[] {GroupUtil.getEncodedId(groupId), source}); + GROUP_ID + " = ?", + new String[] {GroupUtil.getEncodedId(groupId)}); } public void updateTitle(byte[] groupId, String title) { @@ -224,27 +221,6 @@ public class GroupDatabase extends Database { database.update(TABLE_NAME, values, GROUP_ID + " = ?", new String[] {GroupUtil.getEncodedId(id)}); } - public String getOwner(byte[] id) { - Cursor cursor = null; - - try { - SQLiteDatabase readableDatabase = databaseHelper.getReadableDatabase(); - if (readableDatabase == null) - return null; - - cursor = databaseHelper.getReadableDatabase().query(TABLE_NAME, new String[] {OWNER}, - GROUP_ID + " = ?", - new String[] {GroupUtil.getEncodedId(id)}, - null, null, null); - if (cursor != null && cursor.moveToFirst()) { - return cursor.getString(cursor.getColumnIndexOrThrow(OWNER)); - } - return null; - } finally { - if (cursor != null) - cursor.close(); - } - } public byte[] allocateGroupId() { try { @@ -272,7 +248,6 @@ public class GroupDatabase extends Database { return new GroupRecord(cursor.getString(cursor.getColumnIndexOrThrow(GROUP_ID)), cursor.getString(cursor.getColumnIndexOrThrow(TITLE)), - cursor.getString(cursor.getColumnIndexOrThrow(OWNER)), cursor.getString(cursor.getColumnIndexOrThrow(MEMBERS)), cursor.getBlob(cursor.getColumnIndexOrThrow(AVATAR)), cursor.getLong(cursor.getColumnIndexOrThrow(AVATAR_ID)), @@ -292,7 +267,6 @@ public class GroupDatabase extends Database { private final String id; private final String title; - private final String owner; private final List members; private final byte[] avatar; private final long avatarId; @@ -301,13 +275,12 @@ public class GroupDatabase extends Database { private final String relay; private final boolean active; - public GroupRecord(String id, String title, String owner, String members, byte[] avatar, + public GroupRecord(String id, String title, String members, byte[] avatar, long avatarId, byte[] avatarKey, String avatarContentType, String relay, boolean active) { this.id = id; this.title = title; - this.owner = owner; this.members = Util.split(members, ","); this.avatar = avatar; this.avatarId = avatarId; @@ -329,10 +302,6 @@ public class GroupDatabase extends Database { return title; } - public String getOwner() { - return owner; - } - public List getMembers() { return members; } diff --git a/src/org/thoughtcrime/securesms/service/GroupReceiver.java b/src/org/thoughtcrime/securesms/service/GroupReceiver.java index fe35090f3..4f8d9c9fe 100644 --- a/src/org/thoughtcrime/securesms/service/GroupReceiver.java +++ b/src/org/thoughtcrime/securesms/service/GroupReceiver.java @@ -110,7 +110,7 @@ public class GroupReceiver { } if (group.hasName() || group.hasAvatar()) { - database.update(id, message.getSource(), group.getName(), group.getAvatar()); + database.update(id, group.getName(), group.getAvatar()); } if (group.hasName() && group.getName() != null && group.getName().equals(groupRecord.getTitle())) {