summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2bc764a)
raw | patch | inline | side by side (parent: 2bc764a)
author | Florian Forster <sifnfors@informatik.stud.uni-erlangen.de> | |
Thu, 12 Jun 2008 13:44:59 +0000 (15:44 +0200) | ||
committer | Florian Forster <sifnfors@informatik.stud.uni-erlangen.de> | |
Thu, 12 Jun 2008 13:44:59 +0000 (15:44 +0200) |
The exec plugin copies the notifications before creating threads, so we need to
be able to copy the meta data to a second notification.
be able to copy the meta data to a second notification.
src/plugin.c | patch | blob | history | |
src/plugin.h | patch | blob | history |
diff --git a/src/plugin.c b/src/plugin.c
index 27074a75e108131e297fd60b15d644e62ceb595c..77041c9ef9d8e015c489c46df87d834bd7885139 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
return (plugin_notification_meta_add (n, name, NM_TYPE_BOOLEAN, &value));
}
+int plugin_notification_meta_copy (notification_t *dst,
+ const notification_t *src)
+{
+ notification_meta_t *meta;
+
+ for (meta = src->meta; meta != NULL; meta = meta->next)
+ {
+ if (meta->type == NM_TYPE_STRING)
+ plugin_notification_meta_add_string (dst, meta->name,
+ meta->value_string);
+ else if (meta->type == NM_TYPE_SIGNED_INT)
+ plugin_notification_meta_add_signed_int (dst, meta->name,
+ meta->value_signed_int);
+ else if (meta->type == NM_TYPE_UNSIGNED_INT)
+ plugin_notification_meta_add_unsigned_int (dst, meta->name,
+ meta->value_unsigned_int);
+ else if (meta->type == NM_TYPE_DOUBLE)
+ plugin_notification_meta_add_double (dst, meta->name,
+ meta->value_double);
+ else if (meta->type == NM_TYPE_BOOLEAN)
+ plugin_notification_meta_add_boolean (dst, meta->name,
+ meta->value_boolean);
+ }
+
+ return (0);
+} /* int plugin_notification_meta_copy */
+
int plugin_notification_meta_free (notification_t *n)
{
notification_meta_t *this;
diff --git a/src/plugin.h b/src/plugin.h
index 7aac79fc260eb925f56a05ac413dd99b1548b6e2..3bf7e4c1d01174f5f95671f9fd1ea6ed9943eeeb 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
int plugin_notification_meta_add_boolean (notification_t *n,
const char *name,
bool value);
+
+int plugin_notification_meta_copy (notification_t *dst,
+ const notification_t *src);
+
int plugin_notification_meta_free (notification_t *n);
#endif /* PLUGIN_H */