db->settings = nmem_malloc(service->nmem, sizeof(struct settings*) *
settings_num(service));
+ db->num_settings = settings_num(service);
memset(db->settings, 0, sizeof(struct settings*) * settings_num(service));
idset = nmem_malloc(service->nmem, sizeof(*idset));
idset->precedence = 0;
struct http_request *rq = c->request;
struct http_session *s = locate_session(rq, rs);
struct hitsbytarget *ht;
+ const char *settings = http_argbyname(rq, "settings");
int count, i;
if (!s)
wrbuf_puts(c->wrbuf, "<state>");
wrbuf_xmlputs(c->wrbuf, ht[i].state);
wrbuf_puts(c->wrbuf, "</state>\n");
-
+ if (settings && *settings == '1')
+ {
+ wrbuf_puts(c->wrbuf, "<settings>\n");
+ wrbuf_puts(c->wrbuf, wrbuf_cstr(ht[i].settings_xml));
+ wrbuf_puts(c->wrbuf, "</settings>\n");
+ }
wrbuf_puts(c->wrbuf, "</target>");
+ wrbuf_destroy(ht[i].settings_xml);
}
wrbuf_puts(c->wrbuf, "</bytarget>");
return rdoc;
}
+void session_settings_dump(struct session *se,
+ struct session_database *db,
+ WRBUF w)
+{
+ if (db->settings)
+ {
+ struct conf_service *service = se->service;
+ int i, num = settings_num(service);
+ for (i = 0; i < num; i++)
+ {
+ struct setting *s = db->settings[i];
+ for (;s; s = s->next)
+ {
+ wrbuf_puts(w, "<set name=\"");
+ wrbuf_xmlputs(w, s->name);
+ wrbuf_puts(w, "\" value=\"");
+ wrbuf_xmlputs(w, s->value);
+ wrbuf_puts(w, "\"/>\n");
+ }
+ }
+ }
+}
+
// Retrieve first defined value for 'name' for given database.
// Will be extended to take into account user associated with session
const char *session_setting_oneval(struct session_database *db, int offset)
*count = 0;
for (cl = se->clients; cl; cl = client_next_in_session(cl))
{
+ WRBUF w = wrbuf_alloc();
const char *name = session_setting_oneval(client_get_database(cl),
PZ_NAME);
res[*count].diagnostic = client_get_diagnostic(cl);
res[*count].state = client_get_state_str(cl);
res[*count].connected = client_get_connection(cl) ? 1 : 0;
+ session_settings_dump(se, client_get_database(cl), w);
+ res[*count].settings_xml = w;
(*count)++;
}
return res;