about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-01-23 23:18:55 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-01-23 23:18:55 +0100
commitcb1dbb2732e985ac8993b84ac3188b4a8bcda3e6 (patch)
tree6016b9b5c2ddf4e67ab7721e36705872081fdd70 /src
parent2d19ad0db4b41a800e1753922c0d09d136473812 (diff)
downloadprofani-tty-cb1dbb2732e985ac8993b84ac3188b4a8bcda3e6.tar.gz
xep-0092: send OS too
So far we only sent client name and version. Let's also send the OS
name.
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/iq.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index b2fed28c..5cdf29b1 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -1598,8 +1598,29 @@ _version_get_handler(xmpp_stanza_t *const stanza)
         xmpp_stanza_set_text(version_txt, version_str->str);
         xmpp_stanza_add_child(version, version_txt);
 
+        xmpp_stanza_t *os = xmpp_stanza_new(ctx);
+        xmpp_stanza_set_name(os, "os");
+        xmpp_stanza_t *os_txt = xmpp_stanza_new(ctx);
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(PLATFORM_CYGWIN)
+        xmpp_stanza_set_text(os_txt, "Windows");
+#elif defined(__linux__)
+        xmpp_stanza_set_text(os_txt, "Linux");
+#elif defined(__APPLE__)
+        xmpp_stanza_set_text(os_txt, "Apple");
+#elif defined(__FreeBSD__)
+        xmpp_stanza_set_text(os_txt, "FreeBSD");
+#elif defined(__NetBSD__)
+        xmpp_stanza_set_text(os_txt, "__NetBSD__");
+#elif defined(__OpenBSD__)
+        xmpp_stanza_set_text(os_txt, "__OpenBSD__");
+#else
+        xmpp_stanza_set_text(os_txt, "Unknown");
+#endif
+        xmpp_stanza_add_child(os, os_txt);
+
         xmpp_stanza_add_child(query, name);
         xmpp_stanza_add_child(query, version);
+        xmpp_stanza_add_child(query, os);
         xmpp_stanza_add_child(response, query);
 
         iq_send_stanza(response);
@@ -1607,8 +1628,10 @@ _version_get_handler(xmpp_stanza_t *const stanza)
         g_string_free(version_str, TRUE);
         xmpp_stanza_release(name_txt);
         xmpp_stanza_release(version_txt);
+        xmpp_stanza_release(os_txt);
         xmpp_stanza_release(name);
         xmpp_stanza_release(version);
+        xmpp_stanza_release(os);
         xmpp_stanza_release(query);
         xmpp_stanza_release(response);
     }