Skip to content

Commit cf5d283

Browse files
authored
Owner property: only one href; HrefList properties: remove shortcut for first property (#71)
1 parent 8691192 commit cf5d283

File tree

12 files changed

+42
-20
lines changed

12 files changed

+42
-20
lines changed

src/main/kotlin/at/bitfire/dav4jvm/UrlUtils.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ import okhttp3.HttpUrl
1616

1717
object UrlUtils {
1818

19-
@Deprecated("Use equalsForWebDAV instead", ReplaceWith("url1.equalsForWebDAV(url2)"))
20-
fun equals(url1: HttpUrl, url2: HttpUrl) = url1.equalsForWebDAV(url2)
21-
2219
/**
2320
* Gets the first-level domain name (without subdomains) from a host name.
2421
* Also removes trailing dots.

src/main/kotlin/at/bitfire/dav4jvm/XmlReader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class XmlReader(
9090
val depth = parser.depth
9191
var eventType = parser.eventType
9292
while (!((eventType == XmlPullParser.END_TAG || eventType == XmlPullParser.END_DOCUMENT) && parser.depth == depth)) {
93-
if (eventType == XmlPullParser.START_TAG && parser.depth == depth + 1 && parser.propertyName() == name)
93+
if (eventType == XmlPullParser.START_TAG && parser.depth == depth + 1 && parser.propertyName() == name && result == null)
9494
result = parser.nextText()
9595
eventType = parser.next()
9696
}

src/main/kotlin/at/bitfire/dav4jvm/property/caldav/CalendarHomeSet.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
package at.bitfire.dav4jvm.property.caldav
1212

1313
import at.bitfire.dav4jvm.Property
14-
import at.bitfire.dav4jvm.property.webdav.HrefListProperty
14+
import at.bitfire.dav4jvm.property.common.HrefListProperty
1515
import org.xmlpull.v1.XmlPullParser
1616

1717
data class CalendarHomeSet(

src/main/kotlin/at/bitfire/dav4jvm/property/caldav/CalendarProxyReadFor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
package at.bitfire.dav4jvm.property.caldav
1212

1313
import at.bitfire.dav4jvm.Property
14-
import at.bitfire.dav4jvm.property.webdav.HrefListProperty
14+
import at.bitfire.dav4jvm.property.common.HrefListProperty
1515
import org.xmlpull.v1.XmlPullParser
1616

1717
data class CalendarProxyReadFor(

src/main/kotlin/at/bitfire/dav4jvm/property/caldav/CalendarProxyWriteFor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
package at.bitfire.dav4jvm.property.caldav
1212

1313
import at.bitfire.dav4jvm.Property
14-
import at.bitfire.dav4jvm.property.webdav.HrefListProperty
14+
import at.bitfire.dav4jvm.property.common.HrefListProperty
1515
import org.xmlpull.v1.XmlPullParser
1616

1717
data class CalendarProxyWriteFor(

src/main/kotlin/at/bitfire/dav4jvm/property/caldav/CalendarUserAddressSet.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
package at.bitfire.dav4jvm.property.caldav
1212

1313
import at.bitfire.dav4jvm.Property
14-
import at.bitfire.dav4jvm.property.webdav.HrefListProperty
14+
import at.bitfire.dav4jvm.property.common.HrefListProperty
1515
import org.xmlpull.v1.XmlPullParser
1616

1717
data class CalendarUserAddressSet(

src/main/kotlin/at/bitfire/dav4jvm/property/caldav/Source.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
package at.bitfire.dav4jvm.property.caldav
1212

1313
import at.bitfire.dav4jvm.Property
14-
import at.bitfire.dav4jvm.property.webdav.HrefListProperty
14+
import at.bitfire.dav4jvm.property.common.HrefListProperty
1515
import org.xmlpull.v1.XmlPullParser
1616

1717
class Source(

src/main/kotlin/at/bitfire/dav4jvm/property/carddav/AddressbookHomeSet.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
package at.bitfire.dav4jvm.property.carddav
1212

1313
import at.bitfire.dav4jvm.Property
14-
import at.bitfire.dav4jvm.property.webdav.HrefListProperty
14+
import at.bitfire.dav4jvm.property.common.HrefListProperty
1515
import org.xmlpull.v1.XmlPullParser
1616

1717
class AddressbookHomeSet(

src/main/kotlin/at/bitfire/dav4jvm/property/webdav/HrefListProperty.kt renamed to src/main/kotlin/at/bitfire/dav4jvm/property/common/HrefListProperty.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* SPDX-License-Identifier: MPL-2.0
99
*/
1010

11-
package at.bitfire.dav4jvm.property.webdav
11+
package at.bitfire.dav4jvm.property.common
1212

1313
import at.bitfire.dav4jvm.DavResource
1414
import at.bitfire.dav4jvm.Property
@@ -25,15 +25,12 @@ abstract class HrefListProperty(
2525
open val hrefs: List<String>
2626
): Property {
2727

28-
val href get() = hrefs.firstOrNull()
29-
30-
3128
abstract class Factory : PropertyFactory {
3229

3330
@Deprecated("hrefs is no longer mutable.", level = DeprecationLevel.ERROR)
3431
fun create(parser: XmlPullParser, list: HrefListProperty): HrefListProperty {
3532
val hrefs = list.hrefs.toMutableList()
36-
XmlReader(parser).readTextPropertyList(DavResource.HREF, hrefs)
33+
XmlReader(parser).readTextPropertyList(DavResource.Companion.HREF, hrefs)
3734
return list
3835
}
3936

@@ -42,10 +39,10 @@ abstract class HrefListProperty(
4239
constructor: (hrefs: List<String>
4340
) -> PropertyType): PropertyType {
4441
val hrefs = mutableListOf<String>()
45-
XmlReader(parser).readTextPropertyList(DavResource.HREF, hrefs)
42+
XmlReader(parser).readTextPropertyList(DavResource.Companion.HREF, hrefs)
4643
return constructor(hrefs)
4744
}
4845

4946
}
5047

51-
}
48+
}

src/main/kotlin/at/bitfire/dav4jvm/property/webdav/GroupMembership.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
package at.bitfire.dav4jvm.property.webdav
1212

1313
import at.bitfire.dav4jvm.Property
14+
import at.bitfire.dav4jvm.property.common.HrefListProperty
1415
import org.xmlpull.v1.XmlPullParser
1516

1617
class GroupMembership(

0 commit comments

Comments
 (0)