summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3ae4243)
raw | patch | inline | side by side (parent: 3ae4243)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 4 Aug 2010 21:08:50 +0000 (23:08 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 4 Aug 2010 21:08:50 +0000 (23:08 +0200) |
src/amqp.c | patch | blob | history |
diff --git a/src/amqp.c b/src/amqp.c
index 488fbac7f9aafee4b803672059a24ce10d146053..859cb270b7fc5f050c14856c2ef78e3cf32e1b4c 100644 (file)
--- a/src/amqp.c
+++ b/src/amqp.c
static char *exchange = NULL;
static char *routingkey = NULL;
static uint8_t delivery_mode = AMQP_DM_VOLATILE;
+static _Bool store_rates = 0;
static amqp_connection_state_t amqp_conn = NULL;
static pthread_mutex_t amqp_conn_lock = PTHREAD_MUTEX_INITIALIZER;
"Password",
"Exchange",
"RoutingKey",
- "Persistent"
+ "Persistent",
+ "StoreRates"
};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
delivery_mode = AMQP_DM_VOLATILE;
return (0);
}
+ else if (strcasecmp ("StoreRates", key) == 0)
+ {
+ if (IS_TRUE (value))
+ store_rates = 1;
+ else
+ store_rates = 0;
+ return (0);
+ }
return (-1);
}
bfree = sizeof (buffer);
bfill = 0;
- format_json_initialize(buffer, &bfill, &bfree);
- /* TODO: Possibly add a config option "StoreRates" and pass the value along here. */
- format_json_value_list(buffer, &bfill, &bfree, ds, vl, /* rates = */ 0);
- format_json_finalize(buffer, &bfill, &bfree);
+ format_json_initialize (buffer, &bfill, &bfree);
+ format_json_value_list (buffer, &bfill, &bfree, ds, vl, store_rates);
+ format_json_finalize (buffer, &bfill, &bfree);
pthread_mutex_lock (&amqp_conn_lock);
status = amqp_write_locked (buffer);