|
|
|
|
@ -50,12 +50,15 @@ public ThunderbirdContactQuery(ThunderbirdContactSourceService owner,
|
|
|
|
|
@Override
|
|
|
|
|
protected void run()
|
|
|
|
|
{
|
|
|
|
|
String file = super.getContactSource().getFilename();
|
|
|
|
|
String filename = super.getContactSource().getFilename();
|
|
|
|
|
File file = new File(filename);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (file.lastModified() > getContactSource().lastDatabaseFileChange)
|
|
|
|
|
{
|
|
|
|
|
// parse the Thunderbird Mork database
|
|
|
|
|
InputStreamReader sr =
|
|
|
|
|
new InputStreamReader(new FileInputStream(file));
|
|
|
|
|
new InputStreamReader(new FileInputStream(filename));
|
|
|
|
|
MorkDocument md = new MorkDocument(sr);
|
|
|
|
|
sr.close();
|
|
|
|
|
|
|
|
|
|
@ -86,9 +89,9 @@ protected void run()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The additional rows at the root-level update/replace the ones in
|
|
|
|
|
// the tables. There's usually neither a table nor a scope defined,
|
|
|
|
|
// so lets just use the default.
|
|
|
|
|
// The additional rows at the root-level update/replace the ones
|
|
|
|
|
// in the tables. There's usually neither a table nor a scope
|
|
|
|
|
// defined, so lets just use the default.
|
|
|
|
|
String defaultScope = md.getDicts().get(0).dereference("^80");
|
|
|
|
|
for (Row r : md.getRows())
|
|
|
|
|
{
|
|
|
|
|
@ -115,12 +118,19 @@ protected void run()
|
|
|
|
|
table.put(rowId, r);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
super.getContactSource().database = db;
|
|
|
|
|
super.getContactSource().defaultScope = defaultScope;
|
|
|
|
|
super.getContactSource().lastDatabaseFileChange =
|
|
|
|
|
file.lastModified();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// okay, "transactions" are applied, now perform the search
|
|
|
|
|
for (Entry<String, Map<String, Row>> table : db.entrySet())
|
|
|
|
|
for (Entry<String, Map<String, Row>> table
|
|
|
|
|
: super.getContactSource().database.entrySet())
|
|
|
|
|
{
|
|
|
|
|
for (Map.Entry<String, Row> e : table.getValue().entrySet())
|
|
|
|
|
{
|
|
|
|
|
if (e.getKey().endsWith(defaultScope))
|
|
|
|
|
if (e.getKey().endsWith(getContactSource().defaultScope))
|
|
|
|
|
{
|
|
|
|
|
readEntry(e.getValue());
|
|
|
|
|
}
|
|
|
|
|
|