summaryrefslogtreecommitdiff
path: root/emacs/xml_interface.c
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2021-09-04 13:13:09 +0300
committerdefanor <defanor@uberspace.net>2021-09-04 13:13:09 +0300
commitf5942754fc0658d364ce4c38f0ecb91c91c2912a (patch)
tree91f25e06be66ebfeaae39dbbeb225fce81ec275d /emacs/xml_interface.c
parent0d5408caf8f1586b37b273ed4b1f38b24c411846 (diff)
Print names and shorter timestamps in xmpp.el
The conversation buffers now follow the <https://docs.modernxmpp.org/client/design/#names> recommendations for names, and the rexmpp_get_name function is adjusted to match those more closely.
Diffstat (limited to 'emacs/xml_interface.c')
-rw-r--r--emacs/xml_interface.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/emacs/xml_interface.c b/emacs/xml_interface.c
index 2541281..92e8c5f 100644
--- a/emacs/xml_interface.c
+++ b/emacs/xml_interface.c
@@ -140,6 +140,17 @@ void req_process (rexmpp_t *s,
xmlNodeAddContent(rep, payload_str);
free(payload_str);
}
+ if (rexmpp_xml_match(child, NULL, "get-name")) {
+ char *jid = xmlNodeGetContent(child);
+ if (jid != NULL) {
+ char *name = rexmpp_get_name(s, jid);
+ if (name != NULL) {
+ xmlNodeAddContent(rep, name);
+ free(name);
+ }
+ free(jid);
+ }
+ }
print_xml(rep);
xmlFreeNode(rep);
return;
@@ -234,7 +245,7 @@ int my_xml_out_cb (rexmpp_t *s, xmlNodePtr node) {
}
-main (int argc, char **argv) {
+int main (int argc, char **argv) {
/* The minimal initialisation: provide an allocated rexmpp_t
structure and an initial jid. */