Skip to content

Commit

Permalink
(fix) we now return all cards when we receive an empty addressbook-qu…
Browse files Browse the repository at this point in the history
…ery REPORT
  • Loading branch information
extrafu committed Oct 21, 2015
1 parent fc9b175 commit 2c72307
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -13,6 +13,7 @@ Bug fixes
- correctly handle the References header over EAS (#3365)
- make sure English is always used when generating Date headers using EAS (#3356)
- don't escape quoted strings during versit generation
- we now return all cards when we receive an empty addressbook-query REPORT

2.3.2 (2015-09-16)
------------------
Expand Down
4 changes: 1 addition & 3 deletions SoObjects/Contacts/SOGoFolder+CardDAV.h
@@ -1,8 +1,6 @@
/* NSObject+CardDAV.h - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
*
* Author: Ludovic Marcotte <ludovic@inverse.ca>
* Copyright (C) 2007-2015 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
8 changes: 5 additions & 3 deletions SoObjects/Contacts/SOGoFolder+CardDAV.m
@@ -1,8 +1,6 @@
/* NSObject+CardDAV.m - this file is part of SOGo
*
* Copyright (C) 2007-2011 Inverse inc.
*
* Author: Ludovic Marcotte <ludovic@inverse.ca>
* Copyright (C) 2007-2015 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -187,6 +185,10 @@ - (NSArray *) _parseContactFilters: (id <DOMElement>) parentNode
[filters addObject: filter];
}

// If no filters are provided, we return everything.
if (![filters count])
[filters addObject: [NSDictionary dictionaryWithObject: @"." forKey: @"mail"]];

return filters;
}

Expand Down

8 comments on commit 2c72307

@rfc2822
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick response!

@kwirk
Copy link

@kwirk kwirk commented on 2c72307 Oct 31, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to only return cards which have an email address?

@kwirk
Copy link

@kwirk kwirk commented on 2c72307 Nov 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposed change from "." to "%" resolved issue I raised in my previous comment. Taken from http://sogo.nu/bugs/view.php?id=3373

@ethoms
Copy link
Contributor

@ethoms ethoms commented on 2c72307 Jan 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same issue as kwirk, only contacts with an email address are returned after doing a reload or using the search.

I first noticed when the contacts synced on my phone via DAVDroid are much less than they should be. So I reloaded the contacts in webmail and bam, most were gone. After a sudden panic I realized I could restore them from backup. After doing so I still seemed to lose them, but only after a reload.

After changing the @"." to @"%" as kwirk suggests, it makes no difference for me, still broken. I also use postgresql. But in a way I'm glad it's not DAVDroid at fault, and it should be fixable fairly easily. I've been concerned that I wouldn't have reliable open source CalDAV/CardDAV sync tool for android, after working well for so long. It disturbs me that as soon as it got mature, they swapped the engine out and it breaks sync with SOGo.

I'll try to patch it myself and report back.

@ethoms
Copy link
Contributor

@ethoms ethoms commented on 2c72307 Jan 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's interesting is that when I apply the above patch (with the @".") to my big production installation that's still on 2.2.14, I don't have the problem. So, there must be another change elsewhere between 2.2.14 and 2.3.6 that has caused this issue.

@ethoms
Copy link
Contributor

@ethoms ethoms commented on 2c72307 Jan 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction to my last post. The webmail shows all my contacts in 2.2.14, but the DAVDroid sync still only shows contacts with email addresses.

@ethoms
Copy link
Contributor

@ethoms ethoms commented on 2c72307 Jan 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it seems I'm confusing myself and probably anyone reading my comments. There seem to be more than one bug. The first is the sync issue with DAVDroid. The second is the webmail "Address Book" issue whereby contacts are missing after a "Reload". It just happens that in both cases only contacts with emails are shown.

So I can confirm kwirk's suggestion of changing "." to "%" fixes the sync done on a regular address book by DAVDroid, on both 2.2.14 and 2.3.6. However, the same change breaks Group Directory (Corporate Directory) syncing by DAVDroid.

So, it seems we need a better fix altogether, and there's a new bug with the webmail address book too.

@ethoms
Copy link
Contributor

@ethoms ethoms commented on 2c72307 Jan 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I found a complete solution for the DAVDroid (CardDav) sync issue. See the following PR: #187

Please sign in to comment.