summaryrefslogtreecommitdiff
path: root/emacs/xml_interface.c
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2021-09-26 10:14:01 +0300
committerdefanor <defanor@uberspace.net>2021-09-26 10:29:53 +0300
commitd169906b768213dd51bf6891fff79bcf16bb1d54 (patch)
treeaa70efe6838af734b1c851c812db94bb09361698 /emacs/xml_interface.c
parent46f60d7d807efaf173c13728975bac44228490e5 (diff)
Add xmpp-http-upload into xmpp.el
Diffstat (limited to 'emacs/xml_interface.c')
-rw-r--r--emacs/xml_interface.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/emacs/xml_interface.c b/emacs/xml_interface.c
index 92e8c5f..110e96f 100644
--- a/emacs/xml_interface.c
+++ b/emacs/xml_interface.c
@@ -74,6 +74,17 @@ xmlNodePtr req_block (xmlNodePtr req) {
return read_response();
}
+void on_http_upload (rexmpp_t *s, void *cb_data, const char *url) {
+ char *fpath = cb_data;
+ xmlNodePtr payload = xmlNewNode(NULL, "http-upload");
+ xmlNewProp(payload, "path", fpath);
+ if (url != NULL) {
+ xmlNewProp(payload, "url", url);
+ }
+ free(fpath);
+ request(payload);
+}
+
void req_process (rexmpp_t *s,
xmlNodePtr elem)
{
@@ -151,6 +162,11 @@ void req_process (rexmpp_t *s,
free(jid);
}
}
+ if (rexmpp_xml_match(child, NULL, "http-upload")) {
+ char *in = xmlNodeGetContent(child);
+ rexmpp_http_upload_path(s, NULL, in, NULL, on_http_upload, strdup(in));
+ free(in);
+ }
print_xml(rep);
xmlFreeNode(rep);
return;