Export some XMPP symbols used in tests

Thu, 26 Oct 2023 22:35:00 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Thu, 26 Oct 2023 22:35:00 -0500
changeset 42436
185c0b83e408
parent 42435
ecf0fdfc8363
child 42437
e3886c8b95fe

Export some XMPP symbols used in tests

For simplicity, this _only_ covers symbols actually used in tests, and does not
attempt to add a Since or similar tag.

Testing Done:
Compiled

Reviewed at https://reviews.imfreedom.org/r/2732/

libpurple/protocols/jabber/auth_digest_md5.h file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/auth_scram.h file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/caps.h file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/jabber.h file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/jutil.h file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/meson.build file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/jabber/auth_digest_md5.h	Thu Oct 26 22:24:08 2023 -0500
+++ b/libpurple/protocols/jabber/auth_digest_md5.h	Thu Oct 26 22:35:00 2023 -0500
@@ -25,6 +25,8 @@
 #ifndef PURPLE_JABBER_AUTH_DIGEST_MD5_H
 #define PURPLE_JABBER_AUTH_DIGEST_MD5_H
 
+#include "jabber.h"
+
 /*
  * Every function in this file is ONLY exposed for tests.
  * DO NOT USE ANYTHING HERE OR YOU WILL BE SENT TO THE PIT OF DESPAIR.
@@ -33,6 +35,7 @@
 /*
  * Parse a DIGEST-MD5 challenge.
  */
+PURPLE_XMPP_EXTERN_FOR_TESTS
 GHashTable *jabber_auth_digest_md5_parse(const char *challenge);
 
 #endif /* PURPLE_JABBER_AUTH_DIGEST_MD5_H */
--- a/libpurple/protocols/jabber/auth_scram.h	Thu Oct 26 22:24:08 2023 -0500
+++ b/libpurple/protocols/jabber/auth_scram.h	Thu Oct 26 22:35:00 2023 -0500
@@ -65,6 +65,7 @@
  *          NOT null-terminated and its length is the length of the binary
  *          output of the hash function in-use.
  */
+PURPLE_XMPP_EXTERN_FOR_TESTS
 guchar *jabber_scram_hi(const JabberScramHash *hash, const GString *str,
                         GString *salt, guint iterations);
 
@@ -79,17 +80,20 @@
  *
  * @returns TRUE if the proofs were successfully calculated. FALSE otherwise.
  */
+PURPLE_XMPP_EXTERN_FOR_TESTS
 gboolean jabber_scram_calc_proofs(JabberScramData *data, GString *salt,
                                   guint iterations);
 
 /**
  * Feed the algorithm with the data from the server.
  */
+PURPLE_XMPP_EXTERN_FOR_TESTS
 gboolean jabber_scram_feed_parser(JabberScramData *data, gchar *in, gchar **out);
 
 /**
  * Clean up and destroy the data struct
  */
+PURPLE_XMPP_EXTERN_FOR_TESTS
 void jabber_scram_data_destroy(JabberScramData *data);
 
 #endif /* PURPLE_JABBER_AUTH_SCRAM_H */
--- a/libpurple/protocols/jabber/caps.h	Thu Oct 26 22:24:08 2023 -0500
+++ b/libpurple/protocols/jabber/caps.h	Thu Oct 26 22:35:00 2023 -0500
@@ -68,6 +68,7 @@
  *	@param hash_type GChecksumType to be used. Either sha-1 or md5.
  *	@return		The base64 encoded SHA-1 hash; must be freed by caller
  */
+PURPLE_XMPP_EXTERN_FOR_TESTS
 gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info,
                                   GChecksumType hash_type);
 
@@ -95,6 +96,7 @@
  * @param query The 'query' element from an IQ reply stanza.
  * @returns A JabberCapsClientInfo struct, or NULL on error
  */
+PURPLE_XMPP_EXTERN_FOR_TESTS
 JabberCapsClientInfo *jabber_caps_parse_client_info(PurpleXmlNode *query);
 
 /**
@@ -105,6 +107,7 @@
  *
  * @param info The info object to free.
  */
+PURPLE_XMPP_EXTERN_FOR_TESTS
 void jabber_caps_client_info_destroy(JabberCapsClientInfo *info);
 
 #endif /* PURPLE_JABBER_CAPS_H */
--- a/libpurple/protocols/jabber/jabber.h	Thu Oct 26 22:24:08 2023 -0500
+++ b/libpurple/protocols/jabber/jabber.h	Thu Oct 26 22:35:00 2023 -0500
@@ -59,6 +59,12 @@
 
 #include <purple.h>
 
+#ifdef PURPLE_XMPP_COMPILATION
+#define PURPLE_XMPP_EXTERN_FOR_TESTS _PURPLE_EXPORT extern
+#else
+#define PURPLE_XMPP_EXTERN_FOR_TESTS _PURPLE_IMPORT extern
+#endif
+
 #include "namespaces.h"
 
 #include "auth.h"
--- a/libpurple/protocols/jabber/jutil.h	Thu Oct 26 22:24:08 2023 -0500
+++ b/libpurple/protocols/jabber/jutil.h	Thu Oct 26 22:35:00 2023 -0500
@@ -44,6 +44,7 @@
 
 #include "jabber.h"
 
+PURPLE_XMPP_EXTERN_FOR_TESTS
 JabberID* jabber_id_new(const char *str);
 
 /**
@@ -52,20 +53,25 @@
  */
 gboolean jabber_id_equal(const JabberID *jid1, const JabberID *jid2);
 
+PURPLE_XMPP_EXTERN_FOR_TESTS
 void jabber_id_free(JabberID *jid);
 
+PURPLE_XMPP_EXTERN_FOR_TESTS
 char *jabber_get_resource(const char *jid);
+PURPLE_XMPP_EXTERN_FOR_TESTS
 char *jabber_get_bare_jid(const char *jid);
 char *jabber_id_get_bare_jid(const JabberID *jid);
 char *jabber_id_get_full_jid(const JabberID *jid);
 
 gboolean jabber_jid_is_domain(const char *jid);
 
+PURPLE_XMPP_EXTERN_FOR_TESTS
 const char *jabber_normalize(const PurpleAccount *account, const char *in);
 
 /* Returns true if JID is the bare JID of our account. */
 gboolean jabber_is_own_account(JabberStream *js, const char *jid);
 
+PURPLE_XMPP_EXTERN_FOR_TESTS
 gboolean jabber_nodeprep_validate(const char *);
 gboolean jabber_domain_validate(const char *);
 gboolean jabber_resourceprep_validate(const char *);
@@ -77,6 +83,7 @@
  *          of the input, or NULL if an error occurred (the string could
  *          not be normalized)
  */
+PURPLE_XMPP_EXTERN_FOR_TESTS
 char *jabber_saslprep(const char *);
 
 /* state -> readable name */
--- a/libpurple/protocols/jabber/meson.build	Thu Oct 26 22:24:08 2023 -0500
+++ b/libpurple/protocols/jabber/meson.build	Thu Oct 26 22:35:00 2023 -0500
@@ -90,7 +90,7 @@
 	JABBER_SOURCES += xmpp_resources
 
 	jabber_prpl = shared_library('jabber', JABBER_SOURCES,
-	    c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-XMPP"'],
+	    c_args : ['-DPURPLE_XMPP_COMPILATION', '-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-XMPP"'],
 	    link_args : jabber_link_args,
 	    dependencies : [gstreamer, idn, libxml, libpurple_dep, libsoup, glib, gio, math, ws2_32],
 	    install : true,

mercurial