summaryrefslogtreecommitdiff
path: root/kolabformat/kolabobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kolabformat/kolabobject.cpp')
-rw-r--r--kolabformat/kolabobject.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/kolabformat/kolabobject.cpp b/kolabformat/kolabobject.cpp
index 3cf3f86..cc50d9e 100644
--- a/kolabformat/kolabobject.cpp
+++ b/kolabformat/kolabobject.cpp
@@ -64,13 +64,22 @@ KCalCore::Event::Ptr readV2EventXML(const QByteArray& xmlData, QStringList& atta
RelationMember parseMemberUrl(const QString &string)
{
- RelationMember member;
+ if (string.startsWith("urn:uuid:")) {
+ RelationMember member;
+ member.gid = string.mid(9);
+ return member;
+ }
QUrl url(QUrl::fromPercentEncoding(string.toLatin1()));
QList<QByteArray> path = url.encodedPath().split('/');
// qDebug() << path;
+ bool isShared = false;
int start = path.indexOf("user");
if (start < 0) {
- Warning() << "Couldn't find \"user\" in path: " << path;
+ start = path.indexOf("shared");
+ isShared = true;
+ }
+ if (start < 0) {
+ Warning() << "Couldn't find \"user\" or \"shared\" in path: " << path;
return RelationMember();
}
path = path.mid(start + 1);
@@ -78,8 +87,10 @@ RelationMember parseMemberUrl(const QString &string)
Warning() << "Incomplete path: " << path;
return RelationMember();
}
- // user-name
- path.removeFirst();
+ RelationMember member;
+ if (!isShared) {
+ member.user = path.takeFirst();
+ }
member.uid = path.takeLast().toLong();
member.mailbox = path;
member.messageId = url.queryItemValue("message-id");
@@ -101,11 +112,18 @@ static QByteArray join(const QList<QByteArray> &list, const QByteArray &c)
KOLAB_EXPORT QString generateMemberUrl(const RelationMember &member)
{
+ if (!member.gid.isEmpty()) {
+ return QString("urn:uuid:%1").arg(member.gid);
+ }
QUrl url;
url.setScheme("imap");
QList<QByteArray> path;
- path << "user";
- path << "localuser@localhost";
+ if (!member.user.isEmpty()) {
+ path << "user";
+ path << member.user.toLatin1();
+ } else {
+ path << "shared";
+ }
path << member.mailbox;
path << QByteArray::number(member.uid);
url.setPath("/" + join(path, "/"));