瀏覽代碼

lib/presence: removed trailing spaces

Daniel-Constantin Mierla 1 年之前
父節點
當前提交
f6f258591f

+ 11 - 11
src/lib/presence/domain_maintainer.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -41,13 +41,13 @@ domain_maintainer_t *create_domain_maintainer()
 	return dm;
 	return dm;
 }
 }
 
 
-void destroy_domain_maintainer(domain_maintainer_t *dm) 
+void destroy_domain_maintainer(domain_maintainer_t *dm)
 {
 {
 	int i, cnt;
 	int i, cnt;
 	notifier_domain_t *d;
 	notifier_domain_t *d;
-	
+
 	if (!dm) return;
 	if (!dm) return;
-			
+
 	DEBUG_LOG("destroying domain maintainer\n");
 	DEBUG_LOG("destroying domain maintainer\n");
 
 
 	cnt = ptr_vector_size(&dm->registered_domains);
 	cnt = ptr_vector_size(&dm->registered_domains);
@@ -68,7 +68,7 @@ static notifier_domain_t *find_domain_nolock(domain_maintainer_t *dm, const str_
 {
 {
 	notifier_domain_t *d = NULL;
 	notifier_domain_t *d = NULL;
 	int i, cnt;
 	int i, cnt;
-	
+
 	cnt = ptr_vector_size(&dm->registered_domains);
 	cnt = ptr_vector_size(&dm->registered_domains);
 	for (i = 0; i < cnt; i++) {
 	for (i = 0; i < cnt; i++) {
 		d = ptr_vector_get(&dm->registered_domains, i);
 		d = ptr_vector_get(&dm->registered_domains, i);
@@ -81,7 +81,7 @@ static notifier_domain_t *find_domain_nolock(domain_maintainer_t *dm, const str_
 static notifier_domain_t *add_domain_nolock(domain_maintainer_t *dm, const str_t *name)
 static notifier_domain_t *add_domain_nolock(domain_maintainer_t *dm, const str_t *name)
 {
 {
 	notifier_domain_t *d = create_notifier_domain(dm->rc_grp, name);
 	notifier_domain_t *d = create_notifier_domain(dm->rc_grp, name);
-	
+
 	if (d) {
 	if (d) {
 		DEBUG_LOG("created domain: \'%.*s\'\n", FMT_STR(d->name));
 		DEBUG_LOG("created domain: \'%.*s\'\n", FMT_STR(d->name));
 		ptr_vector_add(&dm->registered_domains, d);
 		ptr_vector_add(&dm->registered_domains, d);
@@ -93,7 +93,7 @@ static notifier_domain_t *add_domain_nolock(domain_maintainer_t *dm, const str_t
 /* notifier_domain_t *find_notifier_domain(domain_maintainer_t *dm, const str_t *name)
 /* notifier_domain_t *find_notifier_domain(domain_maintainer_t *dm, const str_t *name)
 {
 {
 	notifier_domain_t *d = NULL;
 	notifier_domain_t *d = NULL;
-	
+
 	if (!dm) return NULL;
 	if (!dm) return NULL;
 	cds_mutex_lock(&dm->mutex);
 	cds_mutex_lock(&dm->mutex);
 	d = find_domain_nolock(dm, name);
 	d = find_domain_nolock(dm, name);
@@ -104,9 +104,9 @@ static notifier_domain_t *add_domain_nolock(domain_maintainer_t *dm, const str_t
 notifier_domain_t *register_notifier_domain(domain_maintainer_t *dm, const str_t *name)
 notifier_domain_t *register_notifier_domain(domain_maintainer_t *dm, const str_t *name)
 {
 {
 	notifier_domain_t *d = NULL;
 	notifier_domain_t *d = NULL;
-	
+
 	if (!dm) return NULL;
 	if (!dm) return NULL;
-	
+
 	cds_mutex_lock(&dm->mutex);
 	cds_mutex_lock(&dm->mutex);
 	d = find_domain_nolock(dm, name);
 	d = find_domain_nolock(dm, name);
 	if (!d) d = add_domain_nolock(dm, name);
 	if (!d) d = add_domain_nolock(dm, name);
@@ -121,7 +121,7 @@ static void remove_notifier_domain(domain_maintainer_t *dm, notifier_domain_t *d
 {
 {
 	notifier_domain_t *d = NULL;
 	notifier_domain_t *d = NULL;
 	int i, cnt;
 	int i, cnt;
-	
+
 	cnt = ptr_vector_size(&dm->registered_domains);
 	cnt = ptr_vector_size(&dm->registered_domains);
 	for (i = 0; i < cnt; i++) {
 	for (i = 0; i < cnt; i++) {
 		d = ptr_vector_get(&dm->registered_domains, i);
 		d = ptr_vector_get(&dm->registered_domains, i);
@@ -135,7 +135,7 @@ static void remove_notifier_domain(domain_maintainer_t *dm, notifier_domain_t *d
 void release_notifier_domain(domain_maintainer_t *dm, notifier_domain_t *domain)
 void release_notifier_domain(domain_maintainer_t *dm, notifier_domain_t *domain)
 {
 {
 	if ((!dm) || (!domain)) return;
 	if ((!dm) || (!domain)) return;
-	
+
 	cds_mutex_lock(&dm->mutex);
 	cds_mutex_lock(&dm->mutex);
 	if (remove_reference(&domain->ref)) {
 	if (remove_reference(&domain->ref)) {
 		/* last reference */
 		/* last reference */

+ 3 - 3
src/lib/presence/domain_maintainer.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -40,13 +40,13 @@ typedef struct {
 	cds_mutex_t mutex;
 	cds_mutex_t mutex;
 } domain_maintainer_t;
 } domain_maintainer_t;
 
 
-	
+
 domain_maintainer_t *create_domain_maintainer();
 domain_maintainer_t *create_domain_maintainer();
 void destroy_domain_maintainer(domain_maintainer_t *dm);
 void destroy_domain_maintainer(domain_maintainer_t *dm);
 
 
 notifier_domain_t *register_notifier_domain(domain_maintainer_t *dm, const str_t *name);
 notifier_domain_t *register_notifier_domain(domain_maintainer_t *dm, const str_t *name);
 void release_notifier_domain(domain_maintainer_t *dm, notifier_domain_t *domain);
 void release_notifier_domain(domain_maintainer_t *dm, notifier_domain_t *domain);
-	
+
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif

+ 13 - 13
src/lib/presence/lpidf.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -36,9 +36,9 @@
 static void doc_add_tuple(dstring_t *buf, presentity_info_t *p, presence_tuple_info_t *t)
 static void doc_add_tuple(dstring_t *buf, presentity_info_t *p, presence_tuple_info_t *t)
 {
 {
 	char tmp[64];
 	char tmp[64];
-	
+
 	if (t->status.basic == presence_tuple_closed) return; /* do not append closed tuples */
 	if (t->status.basic == presence_tuple_closed) return; /* do not append closed tuples */
-	
+
 	dstr_append_zt(buf, "Contact: ");
 	dstr_append_zt(buf, "Contact: ");
 	dstr_append_str(buf, &t->contact);
 	dstr_append_str(buf, &t->contact);
 	dstr_append_zt(buf, ";q=");
 	dstr_append_zt(buf, ";q=");
@@ -55,7 +55,7 @@ static void doc_add_presentity(dstring_t *buf, presentity_info_t *p)
 	dstr_append_zt(buf, "To: ");
 	dstr_append_zt(buf, "To: ");
 	dstr_append_str(buf, &p->uri);
 	dstr_append_str(buf, &p->uri);
 	dstr_append_zt(buf, "\r\n");
 	dstr_append_zt(buf, "\r\n");
-	
+
 	t = p->first_tuple;
 	t = p->first_tuple;
 	while (t) {
 	while (t) {
 		doc_add_tuple(buf, p, t);
 		doc_add_tuple(buf, p, t);
@@ -67,34 +67,34 @@ int create_lpidf_document(presentity_info_t *p, str_t *dst, str_t *dst_content_t
 {
 {
 	dstring_t buf;
 	dstring_t buf;
 	int err;
 	int err;
-	
+
 	if (!dst) return -1;
 	if (!dst) return -1;
-	
+
 	str_clear(dst);
 	str_clear(dst);
 	if (dst_content_type) str_clear(dst_content_type);
 	if (dst_content_type) str_clear(dst_content_type);
 
 
 	if (!p) return -1;
 	if (!p) return -1;
-	
+
 	if (dst_content_type) {
 	if (dst_content_type) {
 		if (str_dup_zt(dst_content_type, "text/lpidf") < 0) {
 		if (str_dup_zt(dst_content_type, "text/lpidf") < 0) {
 			return -1;
 			return -1;
 		}
 		}
 	}
 	}
 
 
-/*	if (!p->first_tuple) return 0;*/	/* no tuples => nothing to say */ 
-	
+/*	if (!p->first_tuple) return 0;*/	/* no tuples => nothing to say */
+
 	dstr_init(&buf, 2048);
 	dstr_init(&buf, 2048);
-	
+
 	doc_add_presentity(&buf, p);
 	doc_add_presentity(&buf, p);
-	
+
 	err = dstr_get_str(&buf, dst);
 	err = dstr_get_str(&buf, dst);
 	dstr_destroy(&buf);
 	dstr_destroy(&buf);
-	
+
 	if (err != 0) {
 	if (err != 0) {
 		str_free_content(dst);
 		str_free_content(dst);
 		if (dst_content_type) str_free_content(dst_content_type);
 		if (dst_content_type) str_free_content(dst_content_type);
 	}
 	}
-	
+
 	return err;
 	return err;
 }
 }
 
 

+ 1 - 1
src/lib/presence/lpidf.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.

+ 11 - 11
src/lib/presence/notifier.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -45,17 +45,17 @@ notifier_t *register_notifier(
 void unregister_notifier(notifier_domain_t *domain, notifier_t *info);
 void unregister_notifier(notifier_domain_t *domain, notifier_t *info);
 
 
 /** accepts subscription (internally adds reference to it), thus it can
 /** accepts subscription (internally adds reference to it), thus it can
- * be handled by notifier which called this function 
- * MUST be called in notifier's subscribe function, otherwise the 
- * subscription can NOT be accepted 
+ * be handled by notifier which called this function
+ * MUST be called in notifier's subscribe function, otherwise the
+ * subscription can NOT be accepted
  *
  *
- * Note: only for asynchonously processed subscriptions (synchronous 
+ * Note: only for asynchonously processed subscriptions (synchronous
  * don't need it) */
  * don't need it) */
 void accept_subscription(qsa_subscription_t *s);
 void accept_subscription(qsa_subscription_t *s);
 
 
-/** releases accepted subscription - MUST be called on all accepted 
+/** releases accepted subscription - MUST be called on all accepted
  * subscriptions (only on them!) to be freed from memory !
  * subscriptions (only on them!) to be freed from memory !
- * Note: only for asynchonously processed subscriptions (synchronous 
+ * Note: only for asynchonously processed subscriptions (synchronous
  * don't need it) */
  * don't need it) */
 void release_subscription(qsa_subscription_t *s);
 void release_subscription(qsa_subscription_t *s);
 
 
@@ -72,7 +72,7 @@ typedef enum {
 
 
 typedef struct {
 typedef struct {
 	/* replacement for record_id, package, ... it is much more efficient */
 	/* replacement for record_id, package, ... it is much more efficient */
-	qsa_subscription_t *subscription; 
+	qsa_subscription_t *subscription;
 	qsa_content_type_t *content_type;
 	qsa_content_type_t *content_type;
 	void *data;
 	void *data;
 	int data_len;
 	int data_len;
@@ -83,10 +83,10 @@ typedef struct {
 void free_client_notify_info_content(client_notify_info_t *info);
 void free_client_notify_info_content(client_notify_info_t *info);
 
 
 /* notifications SHOULD be sent through this method */
 /* notifications SHOULD be sent through this method */
-int notify_subscriber(qsa_subscription_t *s, 
+int notify_subscriber(qsa_subscription_t *s,
 		notifier_t *n,
 		notifier_t *n,
-		qsa_content_type_t *content_type, 
-		void *data, 
+		qsa_content_type_t *content_type,
+		void *data,
 		qsa_subscription_status_t status);
 		qsa_subscription_status_t status);
 
 
 /* this can be called in notifier and the returned value is valid
 /* this can be called in notifier and the returned value is valid

+ 52 - 52
src/lib/presence/notifier_domain.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -96,9 +96,9 @@ static notifier_package_t *create_package(const str_t *name)
 static notifier_package_t *get_package(notifier_domain_t *d, const str_t *name)
 static notifier_package_t *get_package(notifier_domain_t *d, const str_t *name)
 {
 {
 	notifier_package_t *p = NULL;
 	notifier_package_t *p = NULL;
-	
+
 	if (is_str_empty(name)) return NULL;
 	if (is_str_empty(name)) return NULL;
-	
+
 	p = find_package(d, name);
 	p = find_package(d, name);
 	if (!p) {
 	if (!p) {
 		p = create_package(name);
 		p = create_package(name);
@@ -106,12 +106,12 @@ static notifier_package_t *get_package(notifier_domain_t *d, const str_t *name)
 	}
 	}
 	return p;
 	return p;
 }
 }
-	
-static void destroy_package(notifier_package_t *p) 
+
+static void destroy_package(notifier_package_t *p)
 {
 {
 	/* notifier_t *e, *n; */
 	/* notifier_t *e, *n; */
 	qsa_subscription_t *s, *ns;
 	qsa_subscription_t *s, *ns;
-	
+
 	/* release all subscriptions ???  */
 	/* release all subscriptions ???  */
 	s = p->first_subscription;
 	s = p->first_subscription;
 	while (s) {
 	while (s) {
@@ -120,7 +120,7 @@ static void destroy_package(notifier_package_t *p)
 		release_subscription(s);
 		release_subscription(s);
 		s = ns;
 		s = ns;
 	}
 	}
-	
+
 	/* !!! don't release notifiers - it is their job !!! */
 	/* !!! don't release notifiers - it is their job !!! */
 	/* it may lead to errors there */
 	/* it may lead to errors there */
 	/* e = p->first_notifier;
 	/* e = p->first_notifier;
@@ -129,7 +129,7 @@ static void destroy_package(notifier_package_t *p)
 		free_notifier(e);
 		free_notifier(e);
 		e = n;
 		e = n;
 	} */
 	} */
-	
+
 	p->first_notifier = NULL;
 	p->first_notifier = NULL;
 	p->last_notifier = NULL;
 	p->last_notifier = NULL;
 	str_free_content(&p->name);
 	str_free_content(&p->name);
@@ -157,7 +157,7 @@ static void add_content_type(notifier_domain_t *d, qsa_content_type_t *p)
 	DOUBLE_LINKED_LIST_ADD(d->first_content_type, d->last_content_type, p);
 	DOUBLE_LINKED_LIST_ADD(d->first_content_type, d->last_content_type, p);
 }
 }
 
 
-static qsa_content_type_t *create_content_type(const str_t *name, 
+static qsa_content_type_t *create_content_type(const str_t *name,
 		destroy_function_f destroy_func)
 		destroy_function_f destroy_func)
 {
 {
 	qsa_content_type_t *p = (qsa_content_type_t*)cds_malloc(sizeof(qsa_content_type_t) + str_len(name));
 	qsa_content_type_t *p = (qsa_content_type_t*)cds_malloc(sizeof(qsa_content_type_t) + str_len(name));
@@ -176,14 +176,14 @@ static qsa_content_type_t *create_content_type(const str_t *name,
 }
 }
 
 
 /** finds existing package or adds new if not exists */
 /** finds existing package or adds new if not exists */
-qsa_content_type_t *register_content_type(notifier_domain_t *d, 
+qsa_content_type_t *register_content_type(notifier_domain_t *d,
 		const str_t *name,
 		const str_t *name,
 		destroy_function_f destroy_func)
 		destroy_function_f destroy_func)
 {
 {
 	qsa_content_type_t *p = NULL;
 	qsa_content_type_t *p = NULL;
-	
+
 	if (is_str_empty(name)) return NULL;
 	if (is_str_empty(name)) return NULL;
-	
+
 	p = find_content_type(d, name);
 	p = find_content_type(d, name);
 	if (!p) {
 	if (!p) {
 		p = create_content_type(name, destroy_func);
 		p = create_content_type(name, destroy_func);
@@ -191,8 +191,8 @@ qsa_content_type_t *register_content_type(notifier_domain_t *d,
 	}
 	}
 	return p;
 	return p;
 }
 }
-	
-static void destroy_content_type(qsa_content_type_t *p) 
+
+static void destroy_content_type(qsa_content_type_t *p)
 {
 {
 	cds_free(p);
 	cds_free(p);
 }
 }
@@ -213,7 +213,7 @@ static void free_subscription(qsa_subscription_t *s)
 /*static void add_server_subscription(notifier_t *n, qsa_subscription_t *s)
 /*static void add_server_subscription(notifier_t *n, qsa_subscription_t *s)
 {
 {
 	server_subscription_t server_s;
 	server_subscription_t server_s;
-	
+
 	server_s.notifier_data = NULL;
 	server_s.notifier_data = NULL;
 	if (n->subscribe(n, &s->record_id, s, &server_s.notifier_data) == 0) {
 	if (n->subscribe(n, &s->record_id, s, &server_s.notifier_data) == 0) {
 		server_s.notifier = n;
 		server_s.notifier = n;
@@ -221,7 +221,7 @@ static void free_subscription(qsa_subscription_t *s)
 	}
 	}
 	else ERROR_LOG("subscription not accepted by notifier %p\n", n);
 	else ERROR_LOG("subscription not accepted by notifier %p\n", n);
 }
 }
-			
+
 static void remove_notifier_from_subscription(qsa_subscription_t *s, notifier_t *n)
 static void remove_notifier_from_subscription(qsa_subscription_t *s, notifier_t *n)
 {
 {
 	int cnt,i;
 	int cnt,i;
@@ -271,11 +271,11 @@ void destroy_notifier_domain(notifier_domain_t *domain)
 	qsa_content_type_t *c, *tmp;
 	qsa_content_type_t *c, *tmp;
 
 
 	/* this function is always called only if no only one reference
 	/* this function is always called only if no only one reference
-	 * to domain exists (see domain maintainer), this should mean, that 
+	 * to domain exists (see domain maintainer), this should mean, that
 	 * all subscribers freed their subscriptions */
 	 * all subscribers freed their subscriptions */
-	
+
 	lock_notifier_domain(domain);
 	lock_notifier_domain(domain);
-	
+
 	/* remove packages */
 	/* remove packages */
 	p = domain->first_package;
 	p = domain->first_package;
 	while (p) {
 	while (p) {
@@ -285,7 +285,7 @@ void destroy_notifier_domain(notifier_domain_t *domain)
 	}
 	}
 	domain->first_package = NULL;
 	domain->first_package = NULL;
 	domain->last_package = NULL;
 	domain->last_package = NULL;
-	
+
 	c = domain->first_content_type;
 	c = domain->first_content_type;
 	while (c) {
 	while (c) {
 		tmp = c;
 		tmp = c;
@@ -294,9 +294,9 @@ void destroy_notifier_domain(notifier_domain_t *domain)
 	}
 	}
 	domain->first_content_type = NULL;
 	domain->first_content_type = NULL;
 	domain->last_content_type = NULL;
 	domain->last_content_type = NULL;
-	
+
 	unlock_notifier_domain(domain);
 	unlock_notifier_domain(domain);
-	
+
 	str_free_content(&domain->name);
 	str_free_content(&domain->name);
 	cds_mutex_destroy(&domain->mutex);
 	cds_mutex_destroy(&domain->mutex);
 	cds_mutex_init(&domain->data_mutex);
 	cds_mutex_init(&domain->data_mutex);
@@ -323,7 +323,7 @@ notifier_t *register_notifier(
 		unlock_notifier_domain(domain);
 		unlock_notifier_domain(domain);
 		return NULL;
 		return NULL;
 	}
 	}
-		
+
 	info = cds_malloc(sizeof(notifier_t));
 	info = cds_malloc(sizeof(notifier_t));
 	if (!info) return info;
 	if (!info) return info;
 
 
@@ -334,17 +334,17 @@ notifier_t *register_notifier(
 	DEBUG_LOG("registered notifier for %.*s\n", FMT_STR(*package));
 	DEBUG_LOG("registered notifier for %.*s\n", FMT_STR(*package));
 
 
 	DOUBLE_LINKED_LIST_ADD(p->first_notifier, p->last_notifier, info);
 	DOUBLE_LINKED_LIST_ADD(p->first_notifier, p->last_notifier, info);
-	
-	/* go through all subscriptions for package and 
+
+	/* go through all subscriptions for package and
 	 * add them to this notifier */
 	 * add them to this notifier */
 	s = p->first_subscription;
 	s = p->first_subscription;
 	while (s) {
 	while (s) {
 		info->subscribe(info, s);
 		info->subscribe(info, s);
 		s = s->next;
 		s = s->next;
 	}
 	}
-	
+
 	unlock_notifier_domain(domain);
 	unlock_notifier_domain(domain);
-	
+
 	return info;
 	return info;
 }
 }
 
 
@@ -357,12 +357,12 @@ void unregister_notifier(notifier_domain_t *domain, notifier_t *info)
 	/* maybe: test if the NOTIFIER is registered before unregistration */
 	/* maybe: test if the NOTIFIER is registered before unregistration */
 
 
 	lock_notifier_domain(domain);
 	lock_notifier_domain(domain);
-	
+
 	p = info->package;
 	p = info->package;
 	if (p) {
 	if (p) {
-		/* accepted subscriptions MUST be removed by the notifier 
+		/* accepted subscriptions MUST be removed by the notifier
 		 * how to solve this ? */
 		 * how to solve this ? */
-		
+
 		/* qsa_subscription_t *s;
 		/* qsa_subscription_t *s;
 		s = p->first_subscription;
 		s = p->first_subscription;
 		while (s) {
 		while (s) {
@@ -381,7 +381,7 @@ void unregister_notifier(notifier_domain_t *domain, notifier_t *info)
 
 
 /* If a notifier publishing watched state registers after subscribe
 /* If a notifier publishing watched state registers after subscribe
  * call, it receives the subscription automatically too! */
  * call, it receives the subscription automatically too! */
-qsa_subscription_t *subscribe(notifier_domain_t *domain, 
+qsa_subscription_t *subscribe(notifier_domain_t *domain,
 		str_t *package,
 		str_t *package,
 		qsa_subscription_data_t *data)
 		qsa_subscription_data_t *data)
 {
 {
@@ -397,7 +397,7 @@ qsa_subscription_t *subscribe(notifier_domain_t *domain,
 		unlock_notifier_domain(domain);
 		unlock_notifier_domain(domain);
 		return NULL;
 		return NULL;
 	}
 	}
-	
+
 	s = cds_malloc(sizeof(qsa_subscription_t));
 	s = cds_malloc(sizeof(qsa_subscription_t));
 	if (!s) {
 	if (!s) {
 		ERROR_LOG("can't allocate memory\n");
 		ERROR_LOG("can't allocate memory\n");
@@ -415,7 +415,7 @@ qsa_subscription_t *subscribe(notifier_domain_t *domain,
 
 
 	/* add a reference for calling subscriber */
 	/* add a reference for calling subscriber */
 	add_reference(&s->ref);
 	add_reference(&s->ref);
-	
+
 	/* browse all notifiers in given package and subscribe to them
 	/* browse all notifiers in given package and subscribe to them
 	 * and add them to notifiers list */
 	 * and add them to notifiers list */
 	cnt = 0;
 	cnt = 0;
@@ -429,10 +429,10 @@ qsa_subscription_t *subscribe(notifier_domain_t *domain,
 	}
 	}
 	unlock_notifier_domain(domain);
 	unlock_notifier_domain(domain);
 	DEBUG_LOG("subscribed to %d notifier(s)\n", cnt);
 	DEBUG_LOG("subscribed to %d notifier(s)\n", cnt);
-	
+
 	return s;
 	return s;
 }
 }
-	
+
 void release_subscription(qsa_subscription_t *s)
 void release_subscription(qsa_subscription_t *s)
 {
 {
 	if (!s) return;
 	if (!s) return;
@@ -457,7 +457,7 @@ void unsubscribe(notifier_domain_t *domain, qsa_subscription_t *s)
 	unlock_subscription_data(s);
 	unlock_subscription_data(s);
 
 
 	lock_notifier_domain(domain);
 	lock_notifier_domain(domain);
-	
+
 	/* maybe: test if the SUBSCRIBER is subscribed before unsubsc. */
 	/* maybe: test if the SUBSCRIBER is subscribed before unsubsc. */
 	p = s->package;
 	p = s->package;
 	if (!p) {
 	if (!p) {
@@ -466,31 +466,31 @@ void unsubscribe(notifier_domain_t *domain, qsa_subscription_t *s)
 	}
 	}
 
 
 	DOUBLE_LINKED_LIST_REMOVE(p->first_subscription, p->last_subscription, s);
 	DOUBLE_LINKED_LIST_REMOVE(p->first_subscription, p->last_subscription, s);
-	
+
 	e = p->first_notifier;
 	e = p->first_notifier;
 	while (e) {
 	while (e) {
 		e->unsubscribe(e, s);
 		e->unsubscribe(e, s);
 		e = e->next;
 		e = e->next;
 	}
 	}
-	
+
 	unlock_notifier_domain(domain);
 	unlock_notifier_domain(domain);
-	
+
 	/* mark subscription data as invalid */
 	/* mark subscription data as invalid */
 	lock_subscription_data(s);
 	lock_subscription_data(s);
 	s->data = NULL;
 	s->data = NULL;
 	unlock_subscription_data(s);
 	unlock_subscription_data(s);
-	
+
 	/* remove clients reference (don't give references to client?) */
 	/* remove clients reference (don't give references to client?) */
 	remove_reference(&s->ref);
 	remove_reference(&s->ref);
-	
-	release_subscription(s); 
+
+	release_subscription(s);
 }
 }
 
 
 /* void notify_subscriber(qsa_subscription_t *s, mq_message_t *msg) */
 /* void notify_subscriber(qsa_subscription_t *s, mq_message_t *msg) */
-int notify_subscriber(qsa_subscription_t *s, 
+int notify_subscriber(qsa_subscription_t *s,
 		notifier_t *n,
 		notifier_t *n,
-		qsa_content_type_t *content_type, 
-		void *data, 
+		qsa_content_type_t *content_type,
+		void *data,
 		qsa_subscription_status_t status)
 		qsa_subscription_status_t status)
 {
 {
 	int ok = 1;
 	int ok = 1;
@@ -502,29 +502,29 @@ int notify_subscriber(qsa_subscription_t *s,
 		ERROR_LOG("BUG: sending notify for <null> subscription\n");
 		ERROR_LOG("BUG: sending notify for <null> subscription\n");
 		ok = 0;
 		ok = 0;
 	}
 	}
-	
+
 	if (!content_type) {
 	if (!content_type) {
 		ERROR_LOG("BUG: content type not given! Possible memory leaks!\n");
 		ERROR_LOG("BUG: content type not given! Possible memory leaks!\n");
 		return -1;
 		return -1;
 	}
 	}
-	
+
 	if (ok) {
 	if (ok) {
 		msg = create_message_ex(sizeof(client_notify_info_t));
 		msg = create_message_ex(sizeof(client_notify_info_t));
 		if (!msg) {
 		if (!msg) {
 			ERROR_LOG("can't create notify message!\n");
 			ERROR_LOG("can't create notify message!\n");
-			ok = 0; 
+			ok = 0;
 		}
 		}
 	}
 	}
-	
+
 	if (ok) {
 	if (ok) {
 		set_data_destroy_function(msg, (destroy_function_f)free_client_notify_info_content);
 		set_data_destroy_function(msg, (destroy_function_f)free_client_notify_info_content);
 		info = (client_notify_info_t*)msg->data;
 		info = (client_notify_info_t*)msg->data;
-		
+
 		info->subscription = s;
 		info->subscription = s;
 		info->content_type = content_type;
 		info->content_type = content_type;
 		info->data = data;
 		info->data = data;
 		info->status = status;
 		info->status = status;
-		
+
 		lock_subscription_data(s);
 		lock_subscription_data(s);
 		if ((s->allow_notifications) && (s->data)) {
 		if ((s->allow_notifications) && (s->data)) {
 			if (s->data->dst) {
 			if (s->data->dst) {
@@ -534,7 +534,7 @@ int notify_subscriber(qsa_subscription_t *s,
 		}
 		}
 		unlock_subscription_data(s);
 		unlock_subscription_data(s);
 	}
 	}
-	
+
 	if (!sent) {
 	if (!sent) {
 		/* free unsent messages */
 		/* free unsent messages */
 		if (msg) free_message(msg);
 		if (msg) free_message(msg);

+ 4 - 4
src/lib/presence/notifier_domain.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -45,7 +45,7 @@ typedef struct _notifier_t notifier_t;
 struct _notifier_domain_t;
 struct _notifier_domain_t;
 typedef struct _notifier_domain_t notifier_domain_t;
 typedef struct _notifier_domain_t notifier_domain_t;
 
 
-/* data hold by subscriber for the time of subscription duration 
+/* data hold by subscriber for the time of subscription duration
  * (from subscribe to unsubscribe; after calling unsubscribe can
  * (from subscribe to unsubscribe; after calling unsubscribe can
  * be destroyed contents of them) */
  * be destroyed contents of them) */
 typedef struct _qsa_subscription_data_t {
 typedef struct _qsa_subscription_data_t {
@@ -88,7 +88,7 @@ struct _notifier_t {
 	server_unsubscribe_func unsubscribe;
 	server_unsubscribe_func unsubscribe;
 	void *user_data; /* private data for this notifier */
 	void *user_data; /* private data for this notifier */
 	notifier_package_t *package;
 	notifier_package_t *package;
-	struct _notifier_t *prev, *next; 
+	struct _notifier_t *prev, *next;
 };
 };
 
 
 struct _notifier_package_t {
 struct _notifier_package_t {
@@ -120,7 +120,7 @@ notifier_domain_t *create_notifier_domain(reference_counter_group_t *g, const st
  * if there are any notifiers, they are unregistered. */
  * if there are any notifiers, they are unregistered. */
 void destroy_notifier_domain(notifier_domain_t *domain);
 void destroy_notifier_domain(notifier_domain_t *domain);
 
 
-qsa_content_type_t *register_content_type(notifier_domain_t *d, 
+qsa_content_type_t *register_content_type(notifier_domain_t *d,
 		const str_t *name,
 		const str_t *name,
 		destroy_function_f destroy_func);
 		destroy_function_f destroy_func);
 
 

+ 49 - 49
src/lib/presence/pidf.c

@@ -1,8 +1,8 @@
-/* 
+/*
  * PIDF parser
  * PIDF parser
  *
  *
  * $Id$
  * $Id$
- * 
+ *
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -40,7 +40,7 @@
 static void doc_add_tuple_note(dstring_t *buf, presence_note_t *n)
 static void doc_add_tuple_note(dstring_t *buf, presence_note_t *n)
 {
 {
 	DEBUG_LOG("doc_add_tuple_note()\n");
 	DEBUG_LOG("doc_add_tuple_note()\n");
-	
+
 	dstr_append_zt(buf, "\t\t<note");
 	dstr_append_zt(buf, "\t\t<note");
 	if (n->lang.len > 0) {
 	if (n->lang.len > 0) {
 		dstr_append_zt(buf, " lang=\"");
 		dstr_append_zt(buf, " lang=\"");
@@ -48,7 +48,7 @@ static void doc_add_tuple_note(dstring_t *buf, presence_note_t *n)
 		dstr_append_zt(buf, "\"");
 		dstr_append_zt(buf, "\"");
 	}
 	}
 	dstr_append_zt(buf, ">");
 	dstr_append_zt(buf, ">");
-	dstr_append_str(buf, &n->value);	
+	dstr_append_str(buf, &n->value);
 	dstr_append_zt(buf, "</note>\r\n");
 	dstr_append_zt(buf, "</note>\r\n");
 }
 }
 
 
@@ -63,13 +63,13 @@ static void doc_add_tuple(dstring_t *buf, presentity_info_t *p, presence_tuple_i
 	presence_note_t *n;
 	presence_note_t *n;
 	extension_element_t *e;
 	extension_element_t *e;
 	char tmp[32];
 	char tmp[32];
-	
+
 	DEBUG_LOG("doc_add_tuple()\n");
 	DEBUG_LOG("doc_add_tuple()\n");
-	
+
 	dstr_append_zt(buf, "\t<tuple id=\"");
 	dstr_append_zt(buf, "\t<tuple id=\"");
 	dstr_append_str(buf, &t->id);
 	dstr_append_str(buf, &t->id);
 	dstr_append_zt(buf, "\">\r\n");
 	dstr_append_zt(buf, "\">\r\n");
-	
+
 	dstr_append_zt(buf, "\t\t<status>\r\n");
 	dstr_append_zt(buf, "\t\t<status>\r\n");
 	if (t->status.basic != presence_tuple_undefined_status) {
 	if (t->status.basic != presence_tuple_undefined_status) {
 		/* do not add unknown status it is not mandatory in PIDF */
 		/* do not add unknown status it is not mandatory in PIDF */
@@ -84,7 +84,7 @@ static void doc_add_tuple(dstring_t *buf, presentity_info_t *p, presence_tuple_i
 		e = e->next;
 		e = e->next;
 	}
 	}
 	dstr_append_zt(buf, "\t\t</status>\r\n");
 	dstr_append_zt(buf, "\t\t</status>\r\n");
-	
+
 	/* add extension elements */
 	/* add extension elements */
 	e = t->first_unknown_element;
 	e = t->first_unknown_element;
 	while (e) {
 	while (e) {
@@ -106,7 +106,7 @@ static void doc_add_tuple(dstring_t *buf, presentity_info_t *p, presence_tuple_i
 		doc_add_tuple_note(buf, n);
 		doc_add_tuple_note(buf, n);
 		n = n->next;
 		n = n->next;
 	}
 	}
-	
+
 	dstr_append_zt(buf, "\t</tuple>\r\n");
 	dstr_append_zt(buf, "\t</tuple>\r\n");
 }
 }
 
 
@@ -114,7 +114,7 @@ static void doc_add_empty_tuple(dstring_t *buf)
 {
 {
 	/* "empty" tuple is needed in PIDF by Microsoft Windows Messenger v. 5.1 and linphone 1.2) */
 	/* "empty" tuple is needed in PIDF by Microsoft Windows Messenger v. 5.1 and linphone 1.2) */
 	DEBUG_LOG("doc_add_empty_tuple()\n");
 	DEBUG_LOG("doc_add_empty_tuple()\n");
-	
+
 	dstr_append_zt(buf, "\t<tuple id=\"none\">\r\n");
 	dstr_append_zt(buf, "\t<tuple id=\"none\">\r\n");
 	dstr_append_zt(buf, "\t\t<status><basic>closed</basic></status>\r\n");
 	dstr_append_zt(buf, "\t\t<status><basic>closed</basic></status>\r\n");
 
 
@@ -124,7 +124,7 @@ static void doc_add_empty_tuple(dstring_t *buf)
 static void doc_add_note(dstring_t *buf, presentity_info_t *p, presence_note_t *n)
 static void doc_add_note(dstring_t *buf, presentity_info_t *p, presence_note_t *n)
 {
 {
 	DEBUG_LOG("doc_add_note()\n");
 	DEBUG_LOG("doc_add_note()\n");
-	
+
 	dstr_append_zt(buf, "\t<note");
 	dstr_append_zt(buf, "\t<note");
 	if (n->lang.len > 0) {
 	if (n->lang.len > 0) {
 		dstr_append_zt(buf, " lang=\"");
 		dstr_append_zt(buf, " lang=\"");
@@ -132,7 +132,7 @@ static void doc_add_note(dstring_t *buf, presentity_info_t *p, presence_note_t *
 		dstr_append_zt(buf, "\"");
 		dstr_append_zt(buf, "\"");
 	}
 	}
 	dstr_append_zt(buf, ">");
 	dstr_append_zt(buf, ">");
-	dstr_append_str(buf, &n->value);	
+	dstr_append_str(buf, &n->value);
 	dstr_append_zt(buf, "</note>\r\n");
 	dstr_append_zt(buf, "</note>\r\n");
 }
 }
 
 
@@ -140,9 +140,9 @@ static void dstr_put_pres_uri(dstring_t *buf, str_t *uri)
 {
 {
 	char *c;
 	char *c;
 	int len = 0;
 	int len = 0;
-	
+
 	if (!uri) return;
 	if (!uri) return;
-	
+
 	c = str_strchr(uri, ':');
 	c = str_strchr(uri, ':');
 	if (c) {
 	if (c) {
 		len = uri->len - (c - uri->s) - 1;
 		len = uri->len - (c - uri->s) - 1;
@@ -167,13 +167,13 @@ static void doc_add_presentity(dstring_t *buf, presentity_info_t *p, int use_cpi
 	DEBUG_LOG("doc_add_presentity()\n");
 	DEBUG_LOG("doc_add_presentity()\n");
 	if (use_cpim_pidf_ns)
 	if (use_cpim_pidf_ns)
 		dstr_append_zt(buf, "<presence xmlns=\"urn:ietf:params:xml:ns:cpim-pidf\" entity=\"");
 		dstr_append_zt(buf, "<presence xmlns=\"urn:ietf:params:xml:ns:cpim-pidf\" entity=\"");
-	else 
+	else
 		dstr_append_zt(buf, "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" entity=\"");
 		dstr_append_zt(buf, "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" entity=\"");
 	/* !!! there SHOULD be pres URI of presentity !!! */
 	/* !!! there SHOULD be pres URI of presentity !!! */
 	dstr_put_pres_uri(buf, &p->uri);
 	dstr_put_pres_uri(buf, &p->uri);
 	/* dstr_append_str(buf, &p->presentity); */ /* only for test !!! */
 	/* dstr_append_str(buf, &p->presentity); */ /* only for test !!! */
 	dstr_append_zt(buf, "\">\r\n");
 	dstr_append_zt(buf, "\">\r\n");
-	
+
 	DEBUG_LOG("adding tuples\n");
 	DEBUG_LOG("adding tuples\n");
 	t = p->first_tuple;
 	t = p->first_tuple;
 	if (!t) doc_add_empty_tuple(buf); /* correction for some strange clients :-) */
 	if (!t) doc_add_empty_tuple(buf); /* correction for some strange clients :-) */
@@ -181,14 +181,14 @@ static void doc_add_presentity(dstring_t *buf, presentity_info_t *p, int use_cpi
 		doc_add_tuple(buf, p, t);
 		doc_add_tuple(buf, p, t);
 		t = t->next;
 		t = t->next;
 	}
 	}
-	
+
 	DEBUG_LOG("adding notes\n");
 	DEBUG_LOG("adding notes\n");
 	n = p->first_note;
 	n = p->first_note;
 	while (n) {
 	while (n) {
 		doc_add_note(buf, p, n);
 		doc_add_note(buf, p, n);
 		n = n->next;
 		n = n->next;
 	}
 	}
-	
+
 	/* add extension elements */
 	/* add extension elements */
 	DEBUG_LOG("adding extension elements\n");
 	DEBUG_LOG("adding extension elements\n");
 	e = p->first_unknown_element;
 	e = p->first_unknown_element;
@@ -204,14 +204,14 @@ int create_pidf_document_ex(presentity_info_t *p, str_t *dst, str_t *dst_content
 {
 {
 	dstring_t buf;
 	dstring_t buf;
 	int err;
 	int err;
-	
+
 	if (!dst) return -1;
 	if (!dst) return -1;
-	
+
 	str_clear(dst);
 	str_clear(dst);
 	if (dst_content_type) str_clear(dst_content_type);
 	if (dst_content_type) str_clear(dst_content_type);
 
 
 	if (!p) return -1;
 	if (!p) return -1;
-	
+
 	if (dst_content_type) {
 	if (dst_content_type) {
 		if (use_cpim_pidf_ns)
 		if (use_cpim_pidf_ns)
 			err = str_dup_zt(dst_content_type, "application/cpim-pidf+xml");
 			err = str_dup_zt(dst_content_type, "application/cpim-pidf+xml");
@@ -219,22 +219,22 @@ int create_pidf_document_ex(presentity_info_t *p, str_t *dst, str_t *dst_content
 			err = str_dup_zt(dst_content_type, "application/pidf+xml;charset=\"UTF-8\"");
 			err = str_dup_zt(dst_content_type, "application/pidf+xml;charset=\"UTF-8\"");
 		if (err < 0) return -1;
 		if (err < 0) return -1;
 	}
 	}
-	
-/*	if (!p->first_tuple) return 0;*/	/* no tuples => nothing to say */ 
-	
+
+/*	if (!p->first_tuple) return 0;*/	/* no tuples => nothing to say */
+
 	dstr_init(&buf, 2048);
 	dstr_init(&buf, 2048);
-	
+
 	dstr_append_zt(&buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
 	dstr_append_zt(&buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
 	doc_add_presentity(&buf, p, use_cpim_pidf_ns);
 	doc_add_presentity(&buf, p, use_cpim_pidf_ns);
-	
+
 	err = dstr_get_str(&buf, dst);
 	err = dstr_get_str(&buf, dst);
 	dstr_destroy(&buf);
 	dstr_destroy(&buf);
-	
+
 	if (err != 0) {
 	if (err != 0) {
 		str_free_content(dst);
 		str_free_content(dst);
 		if (dst_content_type) str_free_content(dst_content_type);
 		if (dst_content_type) str_free_content(dst_content_type);
 	}
 	}
-	
+
 	return err;
 	return err;
 }
 }
 
 
@@ -259,7 +259,7 @@ static int read_note(xmlNode *node, presence_note_t **dst)
 
 
 	*dst = create_presence_note_zt(note, lang);
 	*dst = create_presence_note_zt(note, lang);
 	if (!dst) return -1;
 	if (!dst) return -1;
-	
+
 	return 0;
 	return 0;
 }
 }
 
 
@@ -302,10 +302,10 @@ static int read_extension(xmlNode *ex, extension_element_t **dst, xmlDocPtr doc)
 
 
 	if (!dst) return -1;
 	if (!dst) return -1;
 	*dst = NULL;
 	*dst = NULL;
-	
+
 	e = (extension_element_t*)cds_malloc(sizeof(extension_element_t));
 	e = (extension_element_t*)cds_malloc(sizeof(extension_element_t));
 	if (!e) return -1;
 	if (!e) return -1;
-	
+
 	memset(e, 0, sizeof(*e));
 	memset(e, 0, sizeof(*e));
 	*dst = e;
 	*dst = e;
 
 
@@ -315,7 +315,7 @@ static int read_extension(xmlNode *ex, extension_element_t **dst, xmlDocPtr doc)
 		*dst = NULL;
 		*dst = NULL;
 		return -1;
 		return -1;
 	}
 	}
-	
+
 	return 0;
 	return 0;
 }
 }
 
 
@@ -351,9 +351,9 @@ static int read_tuple(xmlNode *tuple, presence_tuple_info_t **dst, int ignore_ns
 		if (contact.len < 1) {
 		if (contact.len < 1) {
 			ERROR_LOG("empty contact using default\n");
 			ERROR_LOG("empty contact using default\n");
 			/* return -1; */
 			/* return -1; */
-		}	
+		}
 	}
 	}
-	
+
 	/* process status (only one node) */
 	/* process status (only one node) */
 	status_node = find_node(tuple, "status", ns);
 	status_node = find_node(tuple, "status", ns);
 	if (!status_node) {
 	if (!status_node) {
@@ -377,12 +377,12 @@ static int read_tuple(xmlNode *tuple, presence_tuple_info_t **dst, int ignore_ns
 	if (strcasecmp(s, "open") == 0) status = presence_tuple_open;
 	if (strcasecmp(s, "open") == 0) status = presence_tuple_open;
 	if (strcasecmp(s, "closed") == 0) status = presence_tuple_closed;
 	if (strcasecmp(s, "closed") == 0) status = presence_tuple_closed;
 	/* FIXME: handle not standardized variants too (add note to basic status) */
 	/* FIXME: handle not standardized variants too (add note to basic status) */
-	
+
 	/* get ID from tuple node attribute? */
 	/* get ID from tuple node attribute? */
 	id.s = (char *)get_attr_value(find_attr(tuple->properties, "id"));
 	id.s = (char *)get_attr_value(find_attr(tuple->properties, "id"));
 	if (id.s) id.len = strlen(id.s);
 	if (id.s) id.len = strlen(id.s);
 	else id.len = 0;
 	else id.len = 0;
-	
+
 	*dst = create_tuple_info(&contact, &id, status);
 	*dst = create_tuple_info(&contact, &id, status);
 	if (!(*dst)) return -1;
 	if (!(*dst)) return -1;
 
 
@@ -395,7 +395,7 @@ static int read_tuple(xmlNode *tuple, presence_tuple_info_t **dst, int ignore_ns
 			if (cmp_node(n, "note", ns) >= 0) {
 			if (cmp_node(n, "note", ns) >= 0) {
 				res = read_note(n, &note);
 				res = read_note(n, &note);
 				if ((res == 0) && note) {
 				if ((res == 0) && note) {
-					DOUBLE_LINKED_LIST_ADD((*dst)->first_note, 
+					DOUBLE_LINKED_LIST_ADD((*dst)->first_note,
 							(*dst)->last_note, note);
 							(*dst)->last_note, note);
 				}
 				}
 				else break;
 				else break;
@@ -405,20 +405,20 @@ static int read_tuple(xmlNode *tuple, presence_tuple_info_t **dst, int ignore_ns
 			}
 			}
 			else if (cmp_node(n, "status", ns) >= 0) {
 			else if (cmp_node(n, "status", ns) >= 0) {
 				/* skip, already processed */
 				/* skip, already processed */
-			}	
+			}
 			else if (cmp_node(n, "timestamp", ns) >= 0) {
 			else if (cmp_node(n, "timestamp", ns) >= 0) {
 				/* FIXME: process */
 				/* FIXME: process */
 			}
 			}
 			else { /* PIDF extensions - only from non-PIDF namespace? */
 			else { /* PIDF extensions - only from non-PIDF namespace? */
 				res = read_extension(n, &ex, doc);
 				res = read_extension(n, &ex, doc);
-				if ((res == 0) && ex) 
-					DOUBLE_LINKED_LIST_ADD((*dst)->first_unknown_element, 
+				if ((res == 0) && ex)
+					DOUBLE_LINKED_LIST_ADD((*dst)->first_unknown_element,
 							(*dst)->last_unknown_element, ex);
 							(*dst)->last_unknown_element, ex);
 			}
 			}
 		}
 		}
 		n = n->next;
 		n = n->next;
 	}
 	}
-	
+
 	/* handle nested elements in status */
 	/* handle nested elements in status */
 	if (status_node) n = status_node->children;
 	if (status_node) n = status_node->children;
 	else n = NULL;
 	else n = NULL;
@@ -429,8 +429,8 @@ static int read_tuple(xmlNode *tuple, presence_tuple_info_t **dst, int ignore_ns
 			}
 			}
 			else { /* PIDF extensions - only from non-PIDF namespace? */
 			else { /* PIDF extensions - only from non-PIDF namespace? */
 				res = read_extension(n, &ex, doc);
 				res = read_extension(n, &ex, doc);
-				if ((res == 0) && ex) 
-					DOUBLE_LINKED_LIST_ADD((*dst)->status.first_unknown_element, 
+				if ((res == 0) && ex)
+					DOUBLE_LINKED_LIST_ADD((*dst)->status.first_unknown_element,
 							(*dst)->status.last_unknown_element, ex);
 							(*dst)->status.last_unknown_element, ex);
 			}
 			}
 		}
 		}
@@ -449,7 +449,7 @@ static int read_presentity(xmlNode *root, presentity_info_t **dst, int ignore_ns
 	int res = 0;
 	int res = 0;
 	char *ns = ignore_ns ? NULL: pidf_ns;
 	char *ns = ignore_ns ? NULL: pidf_ns;
 	extension_element_t *ex;
 	extension_element_t *ex;
-	
+
 	/* TRACE_LOG("read_presentity(ns=%s)\n", ns ? ns : ""); */
 	/* TRACE_LOG("read_presentity(ns=%s)\n", ns ? ns : ""); */
 	if (cmp_node(root, "presence", ns) < 0) {
 	if (cmp_node(root, "presence", ns) < 0) {
 		ERROR_LOG("document is not presence \n");
 		ERROR_LOG("document is not presence \n");
@@ -471,19 +471,19 @@ static int read_presentity(xmlNode *root, presentity_info_t **dst, int ignore_ns
 			else if (cmp_node(n, "note", ns) >= 0) {
 			else if (cmp_node(n, "note", ns) >= 0) {
 					res = read_note(n, &note);
 					res = read_note(n, &note);
 					if ((res == 0) && note) {
 					if ((res == 0) && note) {
-						DOUBLE_LINKED_LIST_ADD((*dst)->first_note, 
+						DOUBLE_LINKED_LIST_ADD((*dst)->first_note,
 								(*dst)->last_note, note);
 								(*dst)->last_note, note);
 					}
 					}
 					else break;
 					else break;
 				}
 				}
 			else { /* PIDF extensions - only from non-PIDF namespace? */
 			else { /* PIDF extensions - only from non-PIDF namespace? */
 				res = read_extension(n, &ex, doc);
 				res = read_extension(n, &ex, doc);
-				if ((res == 0) && ex) 
-					DOUBLE_LINKED_LIST_ADD((*dst)->first_unknown_element, 
+				if ((res == 0) && ex)
+					DOUBLE_LINKED_LIST_ADD((*dst)->first_unknown_element,
 							(*dst)->last_unknown_element, ex);
 							(*dst)->last_unknown_element, ex);
 				/*if (res != 0) break; ignore errors there */
 				/*if (res != 0) break; ignore errors there */
 			}
 			}
-			
+
 		}
 		}
 		n = n->next;
 		n = n->next;
 	}
 	}
@@ -496,7 +496,7 @@ int parse_pidf_document_ex(presentity_info_t **dst, const char *data, int data_l
 {
 {
 	int res = 0;
 	int res = 0;
 	xmlDocPtr doc;
 	xmlDocPtr doc;
-	
+
 	if (!dst) return -1;
 	if (!dst) return -1;
 	if ((!data) || (data_len < 1)) return -2;
 	if ((!data) || (data_len < 1)) return -2;
 
 

+ 1 - 1
src/lib/presence/pidf.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.

+ 23 - 23
src/lib/presence/pres_doc.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -60,7 +60,7 @@ presentity_info_t *create_presentity_info(const str_t *presentity_uri)
 {
 {
 	presentity_info_t *p;
 	presentity_info_t *p;
 	int len = 0;
 	int len = 0;
-	
+
 	if (!is_str_empty(presentity_uri)) len = presentity_uri->len;
 	if (!is_str_empty(presentity_uri)) len = presentity_uri->len;
 	p = (presentity_info_t*)cds_malloc(sizeof(presentity_info_t) + len);
 	p = (presentity_info_t*)cds_malloc(sizeof(presentity_info_t) + len);
 	if (!p) {
 	if (!p) {
@@ -81,7 +81,7 @@ presentity_info_t *create_presentity_info(const str_t *presentity_uri)
 	/* extensions */
 	/* extensions */
 	p->first_unknown_element = NULL;
 	p->first_unknown_element = NULL;
 	p->last_unknown_element = NULL;
 	p->last_unknown_element = NULL;
-	
+
 	return p;
 	return p;
 }
 }
 
 
@@ -112,7 +112,7 @@ presence_tuple_info_t *create_tuple_info(const str_t *contact, const str_t *id,
 	t->status.last_unknown_element = NULL;
 	t->status.last_unknown_element = NULL;
 	t->priority = 0.0;
 	t->priority = 0.0;
 	t->first_note = NULL;
 	t->first_note = NULL;
-	t->last_note = NULL;	
+	t->last_note = NULL;
 	t->first_unknown_element = NULL;
 	t->first_unknown_element = NULL;
 	t->last_unknown_element = NULL;
 	t->last_unknown_element = NULL;
 	return t;
 	return t;
@@ -145,32 +145,32 @@ void free_tuple_info(presence_tuple_info_t *t)
 {
 {
 	presence_note_t *n, *nn;
 	presence_note_t *n, *nn;
 	extension_element_t *e, *ne;
 	extension_element_t *e, *ne;
-	
+
 	if (!t) return;
 	if (!t) return;
 	str_free_content(&t->contact);
 	str_free_content(&t->contact);
 	str_free_content(&t->id);
 	str_free_content(&t->id);
-	
+
 	n = t->first_note;
 	n = t->first_note;
 	while (n) {
 	while (n) {
 		nn = n->next;
 		nn = n->next;
 		free_presence_note(n);
 		free_presence_note(n);
 		n = nn;
 		n = nn;
 	}
 	}
-	
+
 	e = t->first_unknown_element;
 	e = t->first_unknown_element;
 	while (e) {
 	while (e) {
 		ne = e->next;
 		ne = e->next;
 		free_extension_element(e);
 		free_extension_element(e);
 		e = ne;
 		e = ne;
 	}
 	}
-	
+
 	e = t->status.first_unknown_element;
 	e = t->status.first_unknown_element;
 	while (e) {
 	while (e) {
 		ne = e->next;
 		ne = e->next;
 		free_extension_element(e);
 		free_extension_element(e);
 		e = ne;
 		e = ne;
 	}
 	}
-	
+
 	cds_free(t);
 	cds_free(t);
 }
 }
 
 
@@ -179,7 +179,7 @@ void free_presentity_info(presentity_info_t *p)
 	presence_tuple_info_t *t, *tt;
 	presence_tuple_info_t *t, *tt;
 	presence_note_t *n, *nn;
 	presence_note_t *n, *nn;
 	extension_element_t *np, *ps;
 	extension_element_t *np, *ps;
-	
+
 	if (!p) return;
 	if (!p) return;
 	t = p->first_tuple;
 	t = p->first_tuple;
 	while (t) {
 	while (t) {
@@ -187,21 +187,21 @@ void free_presentity_info(presentity_info_t *p)
 		free_tuple_info(t);
 		free_tuple_info(t);
 		t = tt;
 		t = tt;
 	}
 	}
-	
+
 	n = p->first_note;
 	n = p->first_note;
 	while (n) {
 	while (n) {
 		nn = n->next;
 		nn = n->next;
 		free_presence_note(n);
 		free_presence_note(n);
 		n = nn;
 		n = nn;
 	}
 	}
-	
+
 	ps = p->first_unknown_element;
 	ps = p->first_unknown_element;
 	while (ps) {
 	while (ps) {
 		np = ps->next;
 		np = ps->next;
 		free_extension_element(ps);
 		free_extension_element(ps);
 		ps = np;
 		ps = np;
 	}
 	}
-	
+
 	cds_free(p);
 	cds_free(p);
 }
 }
 
 
@@ -209,7 +209,7 @@ raw_presence_info_t *create_raw_presence_info(const str_t *uri)
 {
 {
 	raw_presence_info_t *p;
 	raw_presence_info_t *p;
 	int len = 0;
 	int len = 0;
-	
+
 	if (!is_str_empty(uri)) len = uri->len;
 	if (!is_str_empty(uri)) len = uri->len;
 	p = (raw_presence_info_t*)cds_malloc(sizeof(raw_presence_info_t) + len);
 	p = (raw_presence_info_t*)cds_malloc(sizeof(raw_presence_info_t) + len);
 	if (!p) {
 	if (!p) {
@@ -222,10 +222,10 @@ raw_presence_info_t *create_raw_presence_info(const str_t *uri)
 		memcpy(p->uri.s, uri->s, len);
 		memcpy(p->uri.s, uri->s, len);
 	}
 	}
 	else p->uri.s = NULL;
 	else p->uri.s = NULL;
-	
+
 	str_clear(&p->pres_doc);
 	str_clear(&p->pres_doc);
 	str_clear(&p->content_type);
 	str_clear(&p->content_type);
-	
+
 	return p;
 	return p;
 }
 }
 
 
@@ -273,7 +273,7 @@ presence_note_t *create_presence_note_zt(const char *note, const char *lang)
 
 
 	note_s = zt2str((char*)note);
 	note_s = zt2str((char*)note);
 	lang_s = zt2str((char*)lang);
 	lang_s = zt2str((char*)lang);
-	
+
 	return create_presence_note(&note_s, &lang_s);
 	return create_presence_note(&note_s, &lang_s);
 }
 }
 
 
@@ -290,14 +290,14 @@ extension_element_t *create_extension_element(const str_t *element)
 		cds_free(t);
 		cds_free(t);
 		return NULL;
 		return NULL;
 	}
 	}
-	
+
 	t->prev = NULL;
 	t->prev = NULL;
 	t->next = NULL;
 	t->next = NULL;
 	return t;
 	return t;
 }
 }
 
 
 /*************************************************************/
 /*************************************************************/
-static int copy_tuple_notes(presence_tuple_info_t *dst_info, 
+static int copy_tuple_notes(presence_tuple_info_t *dst_info,
 		const presence_tuple_info_t *src)
 		const presence_tuple_info_t *src)
 {
 {
 	presence_note_t *n, *nn;
 	presence_note_t *n, *nn;
@@ -368,13 +368,13 @@ presentity_info_t *dup_presentity_info(presentity_info_t *p)
 			pan = pan->next;
 			pan = pan->next;
 		}
 		}
 	}
 	}
-	
+
 	/* extension elements */
 	/* extension elements */
 	if (!err) {
 	if (!err) {
 		paps = p->first_unknown_element;
 		paps = p->first_unknown_element;
 		while (paps) {
 		while (paps) {
 			ps = create_extension_element(&paps->element);
 			ps = create_extension_element(&paps->element);
-			if (ps) DOUBLE_LINKED_LIST_ADD(pinfo->first_unknown_element, 
+			if (ps) DOUBLE_LINKED_LIST_ADD(pinfo->first_unknown_element,
 					pinfo->last_unknown_element, ps);
 					pinfo->last_unknown_element, ps);
 			else {
 			else {
 				ERROR_LOG("can't copy person elements\n");
 				ERROR_LOG("can't copy person elements\n");
@@ -384,12 +384,12 @@ presentity_info_t *dup_presentity_info(presentity_info_t *p)
 			paps = paps->next;
 			paps = paps->next;
 		}
 		}
 	}
 	}
-	
+
 	if (err) {
 	if (err) {
 		free_presentity_info(pinfo);
 		free_presentity_info(pinfo);
 		return NULL;
 		return NULL;
 	}
 	}
-	
+
 	/* DBG("p2p_info() finished\n"); */
 	/* DBG("p2p_info() finished\n"); */
 	return pinfo;
 	return pinfo;
 }
 }

+ 3 - 3
src/lib/presence/pres_doc.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -77,13 +77,13 @@ typedef struct {
 	presence_tuple_info_t *first_tuple, *last_tuple;
 	presence_tuple_info_t *first_tuple, *last_tuple;
 	presence_note_t *first_note, *last_note;/* published notes */
 	presence_note_t *first_note, *last_note;/* published notes */
 	extension_element_t *first_unknown_element, *last_unknown_element;
 	extension_element_t *first_unknown_element, *last_unknown_element;
-		
+
 	char presentity_data[1];
 	char presentity_data[1];
 } presentity_info_t;
 } presentity_info_t;
 
 
 typedef struct {
 typedef struct {
 	str_t uri; /* do not modify this !*/
 	str_t uri; /* do not modify this !*/
-	
+
 	str_t pres_doc;
 	str_t pres_doc;
 	str_t content_type;
 	str_t content_type;
 	char uri_data[1];
 	char uri_data[1];

+ 7 - 7
src/lib/presence/qsa.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -39,7 +39,7 @@ int qsa_initialize()
 {
 {
 	int res = 0;
 	int res = 0;
 
 
-	/* initialization should be called from one process/thread 
+	/* initialization should be called from one process/thread
 	 * it is not synchronized because it is impossible ! */
 	 * it is not synchronized because it is impossible ! */
 	if (!init) {
 	if (!init) {
 		init = (init_data_t*)cds_malloc(sizeof(init_data_t));
 		init = (init_data_t*)cds_malloc(sizeof(init_data_t));
@@ -61,20 +61,20 @@ int qsa_initialize()
 			res = -1;
 			res = -1;
 		}
 		}
 	}
 	}
-			
+
 	if (res == 0) init->init_cnt++;
 	if (res == 0) init->init_cnt++;
 	return res;
 	return res;
 }
 }
 
 
-void qsa_cleanup() 
+void qsa_cleanup()
 {
 {
 	if (init) {
 	if (init) {
 		if (--init->init_cnt == 0) {
 		if (--init->init_cnt == 0) {
 			DEBUG_LOG("cleaning the content\n");
 			DEBUG_LOG("cleaning the content\n");
-			
+
 			/* !!! put the real destruction here !!! */
 			/* !!! put the real destruction here !!! */
 			if (init->dm) destroy_domain_maintainer(init->dm);
 			if (init->dm) destroy_domain_maintainer(init->dm);
-			
+
 			cds_free(init);
 			cds_free(init);
 			init = NULL;
 			init = NULL;
 		}
 		}
@@ -100,6 +100,6 @@ notifier_domain_t *qsa_get_default_domain()
 
 
 void qsa_release_domain(notifier_domain_t *domain)
 void qsa_release_domain(notifier_domain_t *domain)
 {
 {
-	if (init) 
+	if (init)
 		if (init->dm) release_notifier_domain(init->dm, domain);
 		if (init->dm) release_notifier_domain(init->dm, domain);
 }
 }

+ 3 - 3
src/lib/presence/qsa.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -32,7 +32,7 @@ extern "C" {
 
 
 #include <cds/sstr.h>
 #include <cds/sstr.h>
 #include <presence/notifier_domain.h>
 #include <presence/notifier_domain.h>
-	
+
 int qsa_initialize();
 int qsa_initialize();
 void qsa_cleanup();
 void qsa_cleanup();
 
 
@@ -43,5 +43,5 @@ void qsa_release_domain(notifier_domain_t *domain);
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif
-	
+
 #endif
 #endif

+ 2 - 2
src/lib/presence/qsa_params.h

@@ -9,7 +9,7 @@
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {
 #endif
 #endif
-	
+
 typedef struct _qsa_subscription_params_t {
 typedef struct _qsa_subscription_params_t {
 	str_t name;
 	str_t name;
 	str_t value; /* whatever */
 	str_t value; /* whatever */
@@ -19,5 +19,5 @@ typedef struct _qsa_subscription_params_t {
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif
-	
+
 #endif
 #endif

+ 4 - 4
src/lib/presence/subscriber.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -36,9 +36,9 @@ extern "C" {
 
 
 /* If a notifier publishing watched state registers after subscribe
 /* If a notifier publishing watched state registers after subscribe
  * call, it receives the subscription automatically too! */
  * call, it receives the subscription automatically too! */
-/*qsa_subscription_t *subscribe(notifier_domain_t *domain, 
+/*qsa_subscription_t *subscribe(notifier_domain_t *domain,
 		qsa_subscription_t *params);*/
 		qsa_subscription_t *params);*/
-qsa_subscription_t *subscribe(notifier_domain_t *domain, 
+qsa_subscription_t *subscribe(notifier_domain_t *domain,
 		str_t *package,
 		str_t *package,
 		qsa_subscription_data_t *data);
 		qsa_subscription_data_t *data);
 
 
@@ -49,7 +49,7 @@ void set_subscriber_data(qsa_subscription_t *s, void *data);
 void *get_subscriber_data(qsa_subscription_t *s);
 void *get_subscriber_data(qsa_subscription_t *s);
 
 
 void clear_subscription_data(qsa_subscription_data_t *data);
 void clear_subscription_data(qsa_subscription_data_t *data);
-	
+
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif

+ 3 - 3
src/lib/presence/subscription_info.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -32,9 +32,9 @@ typedef struct _subscription_info_t {
 
 
 	client_notify_func notify;
 	client_notify_func notify;
 	str_t record_id;
 	str_t record_id;
-	str_t package;	
+	str_t package;
 	subscription_t *subscription;
 	subscription_t *subscription;
-	
+
 	struct _subscription_info_t *prev, *next;
 	struct _subscription_info_t *prev, *next;
 } subscription_info_t;
 } subscription_info_t;
 
 

+ 3 - 3
src/lib/presence/utils.c

@@ -9,15 +9,15 @@ int extract_server_contact(struct sip_msg *m, str *dst, int uri_only)
 	char *tmp = "";
 	char *tmp = "";
 	if (!dst) return -1;
 	if (!dst) return -1;
 
 
-	switch(m->rcv.bind_address->proto){ 
+	switch(m->rcv.bind_address->proto){
 		case PROTO_NONE: break;
 		case PROTO_NONE: break;
 		case PROTO_UDP: break;
 		case PROTO_UDP: break;
 		case PROTO_TCP: tmp = ";transport=tcp";	break;
 		case PROTO_TCP: tmp = ";transport=tcp";	break;
 		case PROTO_TLS: tmp = ";transport=tls"; break;
 		case PROTO_TLS: tmp = ";transport=tls"; break;
 		case PROTO_SCTP: tmp = ";transport=sctp"; break;
 		case PROTO_SCTP: tmp = ";transport=sctp"; break;
-		default: LOG(L_CRIT, "BUG: extract_server_contact: unknown proto %d\n", m->rcv.bind_address->proto); 
+		default: LOG(L_CRIT, "BUG: extract_server_contact: unknown proto %d\n", m->rcv.bind_address->proto);
 	}
 	}
-	
+
 	dst->len = 7 + m->rcv.bind_address->name.len + m->rcv.bind_address->port_no_str.len + strlen(tmp);
 	dst->len = 7 + m->rcv.bind_address->name.len + m->rcv.bind_address->port_no_str.len + strlen(tmp);
 	if (!uri_only) dst->len += 11;
 	if (!uri_only) dst->len += 11;
 	dst->s = (char *)cds_malloc(dst->len + 1);
 	dst->s = (char *)cds_malloc(dst->len + 1);

+ 5 - 5
src/lib/presence/xml_utils.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -84,7 +84,7 @@ xmlNode *find_node(xmlNode *parent, const char *name, const char *nspace)
 const char *find_value(xmlNode *first_child)
 const char *find_value(xmlNode *first_child)
 {
 {
 	const char *s = NULL;
 	const char *s = NULL;
-	
+
 	xmlNode *c = first_child;
 	xmlNode *c = first_child;
 	while (c) {
 	while (c) {
 		if (c->type == XML_TEXT_NODE) {
 		if (c->type == XML_TEXT_NODE) {
@@ -93,7 +93,7 @@ const char *find_value(xmlNode *first_child)
 		}
 		}
 		c = c->next;
 		c = c->next;
 	}
 	}
-	
+
 	return s;
 	return s;
 }
 }
 
 
@@ -113,7 +113,7 @@ xmlAttr *find_attr(xmlAttr *first, const char *name)
 	return a;
 	return a;
 }
 }
 
 
-const char *get_attr_value(xmlAttr *a) 
+const char *get_attr_value(xmlAttr *a)
 {
 {
 	if (!a) return NULL;
 	if (!a) return NULL;
 	return find_value(a->children);
 	return find_value(a->children);
@@ -123,7 +123,7 @@ int cmp_node(xmlNode *node, const char *name, const char *nspace)
 {
 {
 	if (!node) return -1;
 	if (!node) return -1;
 	if (node->type != XML_ELEMENT_NODE) return -1;
 	if (node->type != XML_ELEMENT_NODE) return -1;
-	
+
 	if (xmlstrcmp(node->name, name) != 0) return -1;
 	if (xmlstrcmp(node->name, name) != 0) return -1;
 	if (!nspace) return 0;
 	if (!nspace) return 0;
 	if (!node->ns) {
 	if (!node->ns) {

+ 1 - 1
src/lib/presence/xml_utils.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.

+ 20 - 20
src/lib/presence/xpidf.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.
@@ -36,14 +36,14 @@
 static void doc_add_tuple_note(dstring_t *buf, presence_note_t *n)
 static void doc_add_tuple_note(dstring_t *buf, presence_note_t *n)
 {
 {
 	dstr_append_zt(buf, "\t\t\t<note>");
 	dstr_append_zt(buf, "\t\t\t<note>");
-	dstr_append_str(buf, &n->value);	
+	dstr_append_str(buf, &n->value);
 	dstr_append_zt(buf, "</note>\r\n");
 	dstr_append_zt(buf, "</note>\r\n");
 }
 }
 
 
 /*static void doc_add_note(dstring_t *buf, presentity_info_t *p, presence_note_t *n)
 /*static void doc_add_note(dstring_t *buf, presentity_info_t *p, presence_note_t *n)
 {
 {
 	DEBUG_LOG("doc_add_note()\n");
 	DEBUG_LOG("doc_add_note()\n");
-	
+
 	dstr_append_zt(buf, "\t<note");
 	dstr_append_zt(buf, "\t<note");
 	if (n->lang.len > 0) {
 	if (n->lang.len > 0) {
 		dstr_append_zt(buf, " lang=\"");
 		dstr_append_zt(buf, " lang=\"");
@@ -51,7 +51,7 @@ static void doc_add_tuple_note(dstring_t *buf, presence_note_t *n)
 		dstr_append_zt(buf, "\"");
 		dstr_append_zt(buf, "\"");
 	}
 	}
 	dstr_append_zt(buf, ">");
 	dstr_append_zt(buf, ">");
-	dstr_append_str(buf, &n->value);	
+	dstr_append_str(buf, &n->value);
 	dstr_append_zt(buf, "</note>\r\n");
 	dstr_append_zt(buf, "</note>\r\n");
 }*/
 }*/
 
 
@@ -59,11 +59,11 @@ static void doc_add_tuple(dstring_t *buf, presentity_info_t *p, presence_tuple_i
 {
 {
 	presence_note_t *n;
 	presence_note_t *n;
 	char tmp[32];
 	char tmp[32];
-	
+
 	dstr_append_zt(buf, "\t<atom id=\"");
 	dstr_append_zt(buf, "\t<atom id=\"");
 	dstr_append_str(buf, &t->id);
 	dstr_append_str(buf, &t->id);
 	dstr_append_zt(buf, "\">\r\n");
 	dstr_append_zt(buf, "\">\r\n");
-	
+
 	dstr_append_zt(buf, "\t\t<address uri=\"");
 	dstr_append_zt(buf, "\t\t<address uri=\"");
 	dstr_append_str(buf, &t->contact);
 	dstr_append_str(buf, &t->contact);
 	dstr_append_zt(buf, "\" priority=\"");
 	dstr_append_zt(buf, "\" priority=\"");
@@ -82,14 +82,14 @@ static void doc_add_tuple(dstring_t *buf, presentity_info_t *p, presence_tuple_i
 		n = n->next;
 		n = n->next;
 	}
 	}
 	/* --- */
 	/* --- */
-	
+
 	dstr_append_zt(buf, "\t</atom>\r\n");
 	dstr_append_zt(buf, "\t</atom>\r\n");
 }
 }
 
 
 static void doc_add_empty_tuple(dstring_t *buf, presentity_info_t *p)
 static void doc_add_empty_tuple(dstring_t *buf, presentity_info_t *p)
 {
 {
 	dstr_append_zt(buf, "\t<atom id=\"none\">\r\n");
 	dstr_append_zt(buf, "\t<atom id=\"none\">\r\n");
-	
+
 	dstr_append_zt(buf, "\t\t<address uri=\"");
 	dstr_append_zt(buf, "\t\t<address uri=\"");
 	dstr_append_str(buf, &p->uri);
 	dstr_append_str(buf, &p->uri);
 	dstr_append_zt(buf, "\" priority=\"1\">\r\n");
 	dstr_append_zt(buf, "\" priority=\"1\">\r\n");
@@ -111,15 +111,15 @@ static void doc_add_presentity(dstring_t *buf, presentity_info_t *p)
 	/* dstr_put_pres_uri(buf, &p->presentity); */
 	/* dstr_put_pres_uri(buf, &p->presentity); */
 	dstr_append_str(buf, &p->uri);
 	dstr_append_str(buf, &p->uri);
 	dstr_append_zt(buf, ";method=SUBSCRIBE\"/>\r\n");
 	dstr_append_zt(buf, ";method=SUBSCRIBE\"/>\r\n");
-	
+
 	t = p->first_tuple;
 	t = p->first_tuple;
 	if (!t) doc_add_empty_tuple(buf, p);
 	if (!t) doc_add_empty_tuple(buf, p);
 	while (t) {
 	while (t) {
 		doc_add_tuple(buf, p, t);
 		doc_add_tuple(buf, p, t);
 		t = t->next;
 		t = t->next;
 	}
 	}
-	
-/*	
+
+/*
 	n = p->first_note;
 	n = p->first_note;
 	while (n) {
 	while (n) {
 		doc_add_note(buf, p, n);
 		doc_add_note(buf, p, n);
@@ -133,27 +133,27 @@ int create_xpidf_document(presentity_info_t *p, str_t *dst, str_t *dst_content_t
 {
 {
 	dstring_t buf;
 	dstring_t buf;
 	int err = 0;
 	int err = 0;
-	
+
 	if (!dst) return -1;
 	if (!dst) return -1;
-	
+
 	str_clear(dst);
 	str_clear(dst);
 	if (dst_content_type) str_clear(dst_content_type);
 	if (dst_content_type) str_clear(dst_content_type);
 
 
 	if (!p) return -1;
 	if (!p) return -1;
-	
-	if (dst_content_type) 
+
+	if (dst_content_type)
 		if (str_dup_zt(dst_content_type, "application/xpidf+xml;charset=\"UTF-8\"") < 0) {
 		if (str_dup_zt(dst_content_type, "application/xpidf+xml;charset=\"UTF-8\"") < 0) {
 			return -1;
 			return -1;
 		}
 		}
 
 
-/*	if (!p->first_tuple) return 0;*/	/* no tuples => nothing to say */ 
-	
+/*	if (!p->first_tuple) return 0;*/	/* no tuples => nothing to say */
+
 	dstr_init(&buf, 2048);
 	dstr_init(&buf, 2048);
-	
+
 	dstr_append_zt(&buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
 	dstr_append_zt(&buf, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
 	dstr_append_zt(&buf, "<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\r\n");
 	dstr_append_zt(&buf, "<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\r\n");
 	doc_add_presentity(&buf, p);
 	doc_add_presentity(&buf, p);
-	
+
 	err = dstr_get_str(&buf, dst);
 	err = dstr_get_str(&buf, dst);
 	dstr_destroy(&buf);
 	dstr_destroy(&buf);
 
 
@@ -161,7 +161,7 @@ int create_xpidf_document(presentity_info_t *p, str_t *dst, str_t *dst_content_t
 		str_free_content(dst);
 		str_free_content(dst);
 		if (dst_content_type) str_free_content(dst_content_type);
 		if (dst_content_type) str_free_content(dst_content_type);
 	}
 	}
-	
+
 	return err;
 	return err;
 }
 }
 
 

+ 1 - 1
src/lib/presence/xpidf.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2005 iptelorg GmbH
  * Copyright (C) 2005 iptelorg GmbH
  *
  *
  * This file is part of ser, a free SIP server.
  * This file is part of ser, a free SIP server.