# HG changeset patch # User Vincent V. # Date 1336297971 -7200 # Node ID 9f228e530c78e8edc574c15ae704e356e53b6098 # Parent e74b3604b3a16c21689a864b40d277466f9ee566 MUCs update diff -r e74b3604b3a1 -r 9f228e530c78 src/com/beem/project/beem/BeemSync.java --- a/src/com/beem/project/beem/BeemSync.java Sun Apr 22 12:56:33 2012 +0200 +++ b/src/com/beem/project/beem/BeemSync.java Sun May 06 11:52:51 2012 +0200 @@ -338,18 +338,24 @@ new String[] { MUCs._ID, MUCs.NAME, MUCs.JID }, MUCs.ACCOUNT_NAME + "=? AND " + MUCs.ACCOUNT_TYPE + "=? AND " + MUCs.JID + "=?", new String[] { accoutname, BeemApplication.BEEM_PACKAGE, bookmarkedConference.getJid() }, null); + ContentValues values = new ContentValues(); + values.put(MUCs.NAME, bookmarkedConference.getName()); + values.put(MUCs.JID, bookmarkedConference.getJid()); + values.put(MUCs.AUTO_JOIN, bookmarkedConference.isAutoJoin()); + values.put(MUCs.SHARED, bookmarkedConference.isShared()); + values.put(MUCs.NICKNAME, bookmarkedConference.getNickname()); + values.put(MUCs.PASSWORD, bookmarkedConference.getPassword()); + values.put(MUCs.ACCOUNT_NAME, accoutname); + values.put(MUCs.ACCOUNT_TYPE, BeemApplication.BEEM_PACKAGE); if (c.getCount() == 0) { - ContentValues values = new ContentValues(); - values.put(MUCs.NAME, bookmarkedConference.getName()); - values.put(MUCs.JID, bookmarkedConference.getJid()); - values.put(MUCs.AUTO_JOIN, bookmarkedConference.isAutoJoin()); - values.put(MUCs.SHARED, bookmarkedConference.isShared()); - values.put(MUCs.NICKNAME, bookmarkedConference.getNickname()); - values.put(MUCs.PASSWORD, bookmarkedConference.getPassword()); - values.put(MUCs.ACCOUNT_NAME, accoutname); - values.put(MUCs.ACCOUNT_TYPE, BeemApplication.BEEM_PACKAGE); mContext.getContentResolver().insert(MUCs.CONTENT_URI, values); - } // TODO: Else update + } else if (c.getCount() == 1){ + c.moveToFirst(); + String id = c.getString(c.getColumnIndex(MUCs._ID)); + mContext.getContentResolver().update(MUCs.CONTENT_URI, values, MUCs._ID + "=?", new String[]{id}); + } else { + //TODO: Error problem sync -> throw toast ! Should not happend + } } }