mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Update: Split client_get_reportxml() report generation into client_get_empty_reportxml(), and client_add_empty_incident()
This commit is contained in:
parent
4210ab31db
commit
13fadf2b5b
31
src/client.c
31
src/client.c
@ -794,12 +794,27 @@ reportxml_t *client_get_reportxml(const char *state_definition, const char *stat
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!report) {
|
if (!report) {
|
||||||
reportxml_node_t *rootnode, *incidentnode, *statenode;
|
report = client_get_empty_reportxml();
|
||||||
|
refobject_unref(client_add_empty_incident(report, state_definition, state_akindof, state_text));
|
||||||
|
}
|
||||||
|
|
||||||
report = refobject_new(reportxml_t);
|
return report;
|
||||||
rootnode = reportxml_get_root_node(report);
|
}
|
||||||
incidentnode = reportxml_node_new(REPORTXML_NODE_TYPE_INCIDENT, NULL, NULL, NULL);
|
|
||||||
statenode = reportxml_node_new(REPORTXML_NODE_TYPE_STATE, NULL, state_definition, state_akindof);
|
reportxml_t *client_get_empty_reportxml(void)
|
||||||
|
{
|
||||||
|
reportxml_t *report = refobject_new(reportxml_t);
|
||||||
|
|
||||||
|
client_get_reportxml__add_basic_stats(report);
|
||||||
|
|
||||||
|
return report;
|
||||||
|
}
|
||||||
|
|
||||||
|
reportxml_node_t *client_add_empty_incident(reportxml_t *report, const char *state_definition, const char *state_akindof, const char *state_text)
|
||||||
|
{
|
||||||
|
reportxml_node_t *rootnode = reportxml_get_root_node(report);
|
||||||
|
reportxml_node_t *incidentnode = reportxml_node_new(REPORTXML_NODE_TYPE_INCIDENT, NULL, NULL, NULL);
|
||||||
|
reportxml_node_t *statenode = reportxml_node_new(REPORTXML_NODE_TYPE_STATE, NULL, state_definition, state_akindof);;
|
||||||
|
|
||||||
if (state_text) {
|
if (state_text) {
|
||||||
reportxml_node_t *textnode;
|
reportxml_node_t *textnode;
|
||||||
@ -813,13 +828,9 @@ reportxml_t *client_get_reportxml(const char *state_definition, const char *stat
|
|||||||
reportxml_node_add_child(incidentnode, statenode);
|
reportxml_node_add_child(incidentnode, statenode);
|
||||||
reportxml_node_add_child(rootnode, incidentnode);
|
reportxml_node_add_child(rootnode, incidentnode);
|
||||||
refobject_unref(statenode);
|
refobject_unref(statenode);
|
||||||
refobject_unref(incidentnode);
|
|
||||||
refobject_unref(rootnode);
|
refobject_unref(rootnode);
|
||||||
}
|
|
||||||
|
|
||||||
client_get_reportxml__add_basic_stats(report);
|
return incidentnode;
|
||||||
|
|
||||||
return report;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
admin_format_t client_get_admin_format_by_content_negotiation(client_t *client)
|
admin_format_t client_get_admin_format_by_content_negotiation(client_t *client)
|
||||||
|
@ -165,6 +165,8 @@ void client_send_redirect(client_t *client, const char *uuid, int status, const
|
|||||||
void client_send_reportxml(client_t *client, reportxml_t *report, document_domain_t domain, const char *xsl, admin_format_t admin_format_hint, int status, const char *location);
|
void client_send_reportxml(client_t *client, reportxml_t *report, document_domain_t domain, const char *xsl, admin_format_t admin_format_hint, int status, const char *location);
|
||||||
void client_send_buffer(client_t *client, int status, const char *mediatype, const char *charset, const char *buffer, ssize_t len, const char *extra_headers);
|
void client_send_buffer(client_t *client, int status, const char *mediatype, const char *charset, const char *buffer, ssize_t len, const char *extra_headers);
|
||||||
reportxml_t *client_get_reportxml(const char *state_definition, const char *state_akindof, const char *state_text);
|
reportxml_t *client_get_reportxml(const char *state_definition, const char *state_akindof, const char *state_text);
|
||||||
|
reportxml_t *client_get_empty_reportxml(void);
|
||||||
|
reportxml_node_t *client_add_empty_incident(reportxml_t *report, const char *state_definition, const char *state_akindof, const char *state_text);
|
||||||
admin_format_t client_get_admin_format_by_content_negotiation(client_t *client);
|
admin_format_t client_get_admin_format_by_content_negotiation(client_t *client);
|
||||||
int client_send_bytes (client_t *client, const void *buf, unsigned len);
|
int client_send_bytes (client_t *client, const void *buf, unsigned len);
|
||||||
int client_read_bytes (client_t *client, void *buf, unsigned len);
|
int client_read_bytes (client_t *client, void *buf, unsigned len);
|
||||||
|
Loading…
Reference in New Issue
Block a user