From f42062abf2ef1b328288e68398d587fff6c25bd2 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 28 Mar 2020 10:17:16 +0100
Subject: Search for network functions in libnetwork


diff --git a/configure.ac b/configure.ac
index 69f3abd..5f6f99d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -318,7 +318,7 @@ AC_ARG_ENABLE( getaddrinfo,
                   [do not use getaddrinfo for dns lookups [default use getaddrinfo]])],
                [getaddrinfo="no"])
 if test "x$getaddrinfo" = "xyes"; then
-    AC_CHECK_FUNCS(getaddrinfo,,getaddrinfo="no")
+    AC_SEARCH_LIBS(getaddrinfo,network,,getaddrinfo="no")
 fi
 AC_MSG_CHECKING([whether to use getaddrinfo])
 AC_MSG_RESULT($getaddrinfo)
@@ -327,6 +327,7 @@ dnl Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS(unistd.h strings.h errno.h arpa/nameser.h)
 AC_CHECK_FUNCS(setsockopt,,[AC_CHECK_LIB(socket,setsockopt)])
+AC_CHECK_FUNCS(setsockopt,,[AC_CHECK_LIB(network,setsockopt)])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
-- 
2.30.2


From cdcdb8fd50b9ca6ded2f0e28ba1e79c55d1a9973 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 28 Mar 2020 13:10:43 +0100
Subject: Hack for detecting libnetwork internal functions

These functions are found indirectly through #defines in the headers.
So a normal AC_SEARCH_LIBS does not work.

diff --git a/configure.ac b/configure.ac
index 5f6f99d..cd617f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -220,7 +220,7 @@ else
     else
       AC_MSG_CHECKING([for res_querydomain in -lresolv (alternate version)])
       save_libs="$LIBS"
-      LIBS="-lresolv $LIBS"
+      LIBS="-lnetwork $LIBS"
       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <resolv.h>]], [[res_querydomain(0,0,0,0,0,0)]])],
                      [AC_MSG_RESULT(yes)
                       AC_DEFINE(HAVE_RES_QUERYDOMAIN)
@@ -248,7 +248,7 @@ else
     else
       AC_MSG_CHECKING([for dn_skipname in -lresolv (alternate version)])
       save_libs="$LIBS"
-      LIBS="-lresolv $LIBS"
+      LIBS="-lnetwork $LIBS"
       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
  #include <resolv.h>]], [[dn_skipname(0,0)]])],
                      [AC_MSG_RESULT(yes)
@@ -277,7 +277,7 @@ else
     else
       AC_MSG_CHECKING([for res_query in -lresolv (alternate version)])
       save_libs="$LIBS"
-      LIBS="-lresolv $LIBS"
+      LIBS="-lnetwork $LIBS"
       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <resolv.h>]], [[res_query(0,0,0,0,0)]])],
                      [AC_MSG_RESULT(yes)
                       AC_DEFINE(HAVE_RES_QUERY)
-- 
2.30.2


From cb8650f396cdd47331d827ee4600899ac3348c78 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 15 Nov 2020 16:18:42 +0100
Subject: Load system certificates.


diff --git a/src/tlsopensslbase.cpp b/src/tlsopensslbase.cpp
index 682f758..2a1a3b7 100644
--- a/src/tlsopensslbase.cpp
+++ b/src/tlsopensslbase.cpp
@@ -126,6 +126,9 @@ namespace gloox
   {
     m_cacerts = cacerts;
 
+    if (m_cacerts.empty())
+      SSL_CTX_set_default_verify_paths( m_ctx );
+
     StringList::const_iterator it = m_cacerts.begin();
     for( ; it != m_cacerts.end(); ++it )
       SSL_CTX_load_verify_locations( m_ctx, (*it).c_str(), 0 );
-- 
2.30.2


From de56500f16d3d8794c1379c160f3e0dd0a665f37 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 13 Feb 2022 19:17:29 +0100
Subject: Make Node and NodeList public

These are required to process XHTML-IM content

diff --git a/src/tag.h b/src/tag.h
index 1e37d46..d1efbf9 100644
--- a/src/tag.h
+++ b/src/tag.h
@@ -50,6 +50,28 @@ namespace gloox
 
     public:
 
+      enum NodeType
+      {
+        TypeTag,                    /**< The Node is a Tag. */
+        TypeString                  /**< The Node is a std::string. */
+      };
+
+      struct Node
+      {
+        Node( NodeType _type, Tag* _tag ) : type( _type ), tag( _tag ) {}
+        Node( NodeType _type, std::string* _str ) : type( _type ), str( _str ) {}
+        ~Node() {}
+
+        NodeType type;
+        union
+        {
+          Tag* tag;
+          std::string* str;
+        };
+      };
+
+      typedef std::list<Node*> NodeList;
+
       /**
        * An XML element's attribute.
        *
@@ -411,6 +433,16 @@ namespace gloox
        */
       const TagList& children() const;
 
+      /**
+       * Use this function to fetch a const list of child elements.
+       * The list includes both tags and cdata nodes, all in order.
+       * @return A constant reference to the list of child elements.
+       */
+      const NodeList& nodes() const {
+          static const NodeList empty;
+          return m_nodes ? *m_nodes : empty;
+      }
+
       /**
        * This function can be used to retrieve the value of a Tag's attribute.
        * @param name The name of the attribute to look for.
@@ -604,28 +636,6 @@ namespace gloox
         XPUnexpectedToken
       };
 
-      enum NodeType
-      {
-        TypeTag,                    /**< The Node is a Tag. */
-        TypeString                  /**< The Node is a std::string. */
-      };
-
-      struct Node
-      {
-        Node( NodeType _type, Tag* _tag ) : type( _type ), tag( _tag ) {}
-        Node( NodeType _type, std::string* _str ) : type( _type ), str( _str ) {}
-        ~Node() {}
-
-        NodeType type;
-        union
-        {
-          Tag* tag;
-          std::string* str;
-        };
-      };
-
-      typedef std::list<Node*> NodeList;
-
       Tag* m_parent;
       TagList* m_children;
       StringPList* m_cdata;
-- 
2.30.2

