--- 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
+ }
}
}