1
0
mirror of https://github.com/nerzhul/ownCloud-SMS-App.git synced 2025-06-26 01:06:34 +00:00
This commit is contained in:
Loic Blot 2015-02-16 15:13:14 +01:00
parent f98822c8ed
commit 73fa4e8ad9

View File

@ -142,6 +142,7 @@ public class SmsFetcher {
JSONObject entry = new JSONObject();
try {
Integer mboxId = -1;
for(int idx = 0;idx < c.getColumnCount(); idx++) {
String colName = c.getColumnName(idx);
@ -149,23 +150,26 @@ public class SmsFetcher {
if (colName.equals(new String("_id")) ||
colName.equals(new String("type"))) {
entry.put(colName, c.getInt(idx));
// bufferize Id for future use
if (colName.equals(new String("_id"))) {
}
}
// Seen and read must be pseudo boolean
else if (colName.equals(new String("read")) ||
colName.equals(new String("seen"))) {
entry.put(colName, c.getInt(idx) > 0 ? "true" : "false");
}
else if (colName.equals(new String("type"))) {
mboxId = c.getInt(idx);
}
else {
entry.put(colName, c.getString(idx));
}
}
// Mailbox ID is required by server
entry.put("mbox", mbID.ordinal());
/*
* Mailbox ID is required by server
* mboxId is greater than server mboxId by 1 because types
* aren't indexed in the same mean
*/
entry.put("mbox", (mboxId - 1));
results.put(entry);
} catch (JSONException e) {