diff options
author | defanor <defanor@uberspace.net> | 2023-11-17 18:34:47 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2023-11-17 18:34:47 +0300 |
commit | ecbef993632c9b3bdf442b381e02e1ad24bc1c87 (patch) | |
tree | e431ae6eabc88974685d7ef7f4d08bb9a0968308 /emacs/xml_interface.c | |
parent | db7a0b227e8e51d40908471206f5cd287c99fa92 (diff) |
Implement MUC self-ping (XEP-0410)
Diffstat (limited to 'emacs/xml_interface.c')
-rw-r--r-- | emacs/xml_interface.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/emacs/xml_interface.c b/emacs/xml_interface.c index 02db77d..f98d5d1 100644 --- a/emacs/xml_interface.c +++ b/emacs/xml_interface.c @@ -182,6 +182,22 @@ void req_process (rexmpp_t *s, char *in = strdup(rexmpp_xml_text_child(child)); rexmpp_http_upload_path(s, NULL, in, NULL, on_http_upload, strdup(id)); free(in); + /* Responding from on_http_upload */ + } else if (rexmpp_xml_match(child, NULL, "muc-ping-set")) { + const char *occupant_jid = rexmpp_xml_find_attr_val(child, "occupant-jid"); + const char *delay = rexmpp_xml_find_attr_val(child, "delay"); + const char *password = rexmpp_xml_find_attr_val(child, "password"); + if (occupant_jid != NULL && delay != NULL) { + snprintf(buf, 64, "%d", + rexmpp_muc_ping_set(s, occupant_jid, password, atoi(delay))); + respond_text(s, id, buf); + } + } else if (rexmpp_xml_match(child, NULL, "muc-ping-remove")) { + const char *occupant_jid = rexmpp_xml_find_attr_val(child, "occupant-jid"); + if (occupant_jid != NULL) { + snprintf(buf, 64, "%d", rexmpp_muc_ping_remove(s, occupant_jid)); + respond_text(s, id, buf); + } } return; } |