summaryrefslogtreecommitdiffstats
path: root/src/lib/eiotas_particle.c
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-31 16:36:43 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-31 16:36:43 +0200
commit8c561b86372f517b3d6ac9137f09a94f6d2425da (patch)
tree4c0ae6a97100e56d8095bbf2e2cfb6329e9cf144 /src/lib/eiotas_particle.c
parent0833dc8bd16c01d30912b7a259f9a0aee2d1b430 (diff)
downloadedoors-8c561b86372f517b3d6ac9137f09a94f6d2425da.zip
edoors-8c561b86372f517b3d6ac9137f09a94f6d2425da.tar.gz
Particle : add eiotas_particle_link_fields_set
Diffstat (limited to 'src/lib/eiotas_particle.c')
-rw-r--r--src/lib/eiotas_particle.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/lib/eiotas_particle.c b/src/lib/eiotas_particle.c
index 7f45848..a2252bd 100644
--- a/src/lib/eiotas_particle.c
+++ b/src/lib/eiotas_particle.c
@@ -116,6 +116,37 @@ EAPI void eiotas_particle_destinations_add(Eiotas_Particle *particle, const char
}
}
+EAPI void eiotas_particle_link_fields_set(Eiotas_Particle *particle, const char *link_fields)
+{
+ int n;
+ unsigned int i;
+ Eina_Stringshare *s;
+ Eina_Array_Iterator it;
+ char *field, *sep;
+
+ EINA_ARRAY_ITER_NEXT(particle->link_fields, i, s, it) eina_stringshare_del(s);
+ eina_array_clean(particle->link_fields);
+
+ field = (char*)link_fields;
+ for(; *field;) {
+ for(; *field==' '; field++) /* eat leading spaces */;
+ sep = field;
+ for(; (*sep && *sep!=EIOTAS_FIELDS_SEP && *sep!=' '); sep++) /* search field end */;
+ n = (sep-field);
+ if(n==0) {
+ ERR("ignore empty field");
+ } else {
+ s = eina_stringshare_add_length(field,n);
+ eina_array_push(particle->link_fields,s);
+ DBG("add field >%s<",s);
+ }
+ for(; (*sep && *sep!=EIOTAS_FIELDS_SEP); sep++) /* eat whatever following */;
+ if(!*sep) return;
+ field = sep+1;
+ }
+ update_link_value(particle,NULL);
+}
+
static void update_link_value(Eiotas_Particle *particle, const char *field)
{
unsigned int i;