Prefix version.h with purple

Fri, 20 Oct 2023 02:10:54 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 20 Oct 2023 02:10:54 -0500
changeset 42376
c6aa66fec38a
parent 42375
8e61249e9b10
child 42377
6e3f1f8709b5

Prefix version.h with purple

And split constants into a separate file as in hasl.

Testing Done:
Compiled.

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

libpurple/meson.build file | annotate | diff | comparison | revisions
libpurple/plugins.h file | annotate | diff | comparison | revisions
libpurple/purpleplugininfo.c file | annotate | diff | comparison | revisions
libpurple/purpleversion.c file | annotate | diff | comparison | revisions
libpurple/purpleversion.h file | annotate | diff | comparison | revisions
libpurple/purpleversionconsts.h.in file | annotate | diff | comparison | revisions
libpurple/version.c file | annotate | diff | comparison | revisions
libpurple/version.h.in file | annotate | diff | comparison | revisions
po/POTFILES.in file | annotate | diff | comparison | revisions
--- a/libpurple/meson.build	Fri Oct 20 01:09:45 2023 -0500
+++ b/libpurple/meson.build	Fri Oct 20 02:10:54 2023 -0500
@@ -96,6 +96,7 @@
 	'purplesqlitehistoryadapter.c',
 	'purpletags.c',
 	'purpleui.c',
+	'purpleversion.c',
 	'purplewhiteboard.c',
 	'purplewhiteboardmanager.c',
 	'purplewhiteboarduiops.c',
@@ -120,7 +121,6 @@
 	'signals.c',
 	'status.c',
 	'util.c',
-	'version.c',
 	'xfer.c',
 	'xmlnode.c'
 ]
@@ -221,6 +221,7 @@
 	'purpletags.h',
 	'purpletyping.h',
 	'purpleui.h',
+	'purpleversion.h',
 	'purplewhiteboard.h',
 	'purplewhiteboardmanager.h',
 	'purplewhiteboardops.h',
@@ -328,7 +329,7 @@
 enums_h = enums[1]
 
 PURPLE_H_INCLUDES = []
-foreach header : purple_coreheaders + purple_mediaheaders + purple_request_headers + ['version.h', 'purpleenums.h']
+foreach header : purple_coreheaders + purple_mediaheaders + purple_request_headers + ['purpleversionconsts.h', 'purpleenums.h']
 	PURPLE_H_INCLUDES += f'#include <libpurple/@header@>'
 endforeach
 purple_h_conf = configuration_data()
@@ -339,8 +340,8 @@
                           configuration : purple_h_conf,
                           install : true,
                           install_dir : get_option('includedir') / purple_filebase)
-version_h = configure_file(input : 'version.h.in',
-                           output : 'version.h',
+version_h = configure_file(input : 'purpleversionconsts.h.in',
+                           output : 'purpleversionconsts.h',
                            configuration : version_conf,
                            install : true,
                            install_dir : get_option('includedir') / purple_include_base)
--- a/libpurple/plugins.h	Fri Oct 20 01:09:45 2023 -0500
+++ b/libpurple/plugins.h	Fri Oct 20 02:10:54 2023 -0500
@@ -29,8 +29,6 @@
 #include <gplugin.h>
 #include <gplugin-native.h>
 
-#include "version.h"
-
 #define PURPLE_PLUGINS_DOMAIN          (g_quark_from_static_string("plugins"))
 
 #define PURPLE_TYPE_PLUGIN             GPLUGIN_TYPE_PLUGIN
--- a/libpurple/purpleplugininfo.c	Fri Oct 20 01:09:45 2023 -0500
+++ b/libpurple/purpleplugininfo.c	Fri Oct 20 02:10:54 2023 -0500
@@ -20,6 +20,7 @@
 #include "core.h"
 #include "debug.h"
 #include "purpleenums.h"
+#include "purpleversionconsts.h"
 #include "util.h"
 
 #include "purpleplugininfo.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purpleversion.c	Fri Oct 20 02:10:54 2023 -0500
@@ -0,0 +1,40 @@
+/*
+ * Purple - Internet Messaging Library
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "version.h"
+
+const guint purple_major_version = PURPLE_MAJOR_VERSION;
+const guint purple_minor_version = PURPLE_MINOR_VERSION;
+const guint purple_micro_version = PURPLE_MICRO_VERSION;
+
+const char *purple_version_check(guint required_major, guint required_minor, guint required_micro)
+{
+	if (required_major > PURPLE_MAJOR_VERSION)
+		return "libpurple version too old (major mismatch)";
+	if (required_major < PURPLE_MAJOR_VERSION)
+		return "libpurple version too new (major mismatch)";
+	if (required_minor > PURPLE_MINOR_VERSION)
+		return "libpurple version too old (minor mismatch)";
+	if ((required_minor == PURPLE_MINOR_VERSION) && (required_micro > PURPLE_MICRO_VERSION))
+		return "libpurple version too old (micro mismatch)";
+	return NULL;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purpleversion.h	Fri Oct 20 02:10:54 2023 -0500
@@ -0,0 +1,93 @@
+/*
+ * Purple - Internet Messaging Library
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
+# error "only <purple.h> may be included directly"
+#endif
+
+#ifndef PURPLE_VERSION_H
+#define PURPLE_VERSION_H
+
+#include <glib.h>
+
+/**
+ * PURPLE_VERSION_CHECK:
+ * @major: The major version to check for.
+ * @minor: The minor version to check for.
+ * @micro: The micro version to check for.
+ *
+ * Checks the version of libpurple being compiled against.  See
+ * #purple_version_check for a runtime check.
+ *
+ * Returns: %TRUE if the version of libpurple is the same or newer than the
+ *          passed-in version.
+ */
+#define PURPLE_VERSION_CHECK(major, minor, micro) ((major) == PURPLE_MAJOR_VERSION && \
+                                                   ((minor) < PURPLE_MINOR_VERSION || \
+                                                    ((minor) == PURPLE_MINOR_VERSION && (micro) <= PURPLE_MICRO_VERSION)))
+
+G_BEGIN_DECLS
+
+/**
+ * purple_version_check:
+ * @required_major: the required major version.
+ * @required_minor: the required minor version.
+ * @required_micro: the required micro version.
+ *
+ * Checks that the libpurple version is compatible with the requested
+ * version
+ *
+ * Returns: %NULL if the versions are compatible, or a string describing
+ *          the version mismatch if not compatible.
+ */
+const char *purple_version_check(guint required_major, guint required_minor, guint required_micro);
+
+/**
+ * purple_major_version:
+ *
+ * The major version of the running libpurple.  Contrast with
+ * #PURPLE_MAJOR_VERSION, which expands at compile time to the major version of
+ * libpurple being compiled against.
+ */
+extern const guint purple_major_version;
+
+/**
+ * purple_minor_version:
+ *
+ * The minor version of the running libpurple.  Contrast with
+ * #PURPLE_MINOR_VERSION, which expands at compile time to the minor version of
+ * libpurple being compiled against.
+ */
+extern const guint purple_minor_version;
+
+/**
+ * purple_micro_version:
+ *
+ * The micro version of the running libpurple.  Contrast with
+ * #PURPLE_MICRO_VERSION, which expands at compile time to the micro version of
+ * libpurple being compiled against.
+ */
+extern const guint purple_micro_version;
+
+G_END_DECLS
+
+#endif /* PURPLE_VERSION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purpleversionconsts.h.in	Fri Oct 20 02:10:54 2023 -0500
@@ -0,0 +1,66 @@
+/*
+ * Purple - Internet Messaging Library
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
+# error "only <purple.h> may be included directly"
+#endif
+
+#ifndef PURPLE_VERSION_CONSTS_H
+#define PURPLE_VERSION_CONSTS_H
+
+/**
+ * PURPLE_MAJOR_VERSION:
+ *
+ * The major version of the running libpurple.
+ */
+#define PURPLE_MAJOR_VERSION (@PURPLE_MAJOR_VERSION@)
+
+/**
+ * PURPLE_MINOR_VERSION:
+ *
+ * The minor version of the running libpurple.
+ */
+#define PURPLE_MINOR_VERSION (@PURPLE_MINOR_VERSION@)
+
+/**
+ * PURPLE_MICRO_VERSION:
+ *
+ * The micro version of the running libpurple.
+ */
+#define PURPLE_MICRO_VERSION (@PURPLE_MICRO_VERSION@)
+
+/**
+ * PURPLE_EXTRA_VERSION:
+ *
+ * The "extra" part of the version number if anything.  Typical values are
+ * "devel", "beta1", "rc2", etc.
+ */
+#define PURPLE_EXTRA_VERSION ("@PURPLE_EXTRA_VERSION@")
+
+/**
+ * PURPLE_VERSION
+ *
+ * The entire version as a string.
+ */
+#define PURPLE_VERSION ("@PURPLE_VERSION@")
+
+#endif /* PURPLE_VERSION_CONSTS_H */
--- a/libpurple/version.c	Fri Oct 20 01:09:45 2023 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/* Purple is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
- */
-
-#include "version.h"
-
-const guint purple_major_version = PURPLE_MAJOR_VERSION;
-const guint purple_minor_version = PURPLE_MINOR_VERSION;
-const guint purple_micro_version = PURPLE_MICRO_VERSION;
-
-const char *purple_version_check(guint required_major, guint required_minor, guint required_micro)
-{
-	if (required_major > PURPLE_MAJOR_VERSION)
-		return "libpurple version too old (major mismatch)";
-	if (required_major < PURPLE_MAJOR_VERSION)
-		return "libpurple version too new (major mismatch)";
-	if (required_minor > PURPLE_MINOR_VERSION)
-		return "libpurple version too old (minor mismatch)";
-	if ((required_minor == PURPLE_MINOR_VERSION) && (required_micro > PURPLE_MICRO_VERSION))
-		return "libpurple version too old (micro mismatch)";
-	return NULL;
-}
--- a/libpurple/version.h.in	Fri Oct 20 01:09:45 2023 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * Purple - Internet Messaging Library
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <https://www.gnu.org/licenses/>.
- */
-
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#endif
-
-#ifndef PURPLE_VERSION_H
-#define PURPLE_VERSION_H
-
-#include <glib.h>
-
-/**
- * PURPLE_MAJOR_VERSION:
- *
- * The major version of the running libpurple.
- */
-#define PURPLE_MAJOR_VERSION (@PURPLE_MAJOR_VERSION@)
-
-/**
- * PURPLE_MINOR_VERSION:
- *
- * The minor version of the running libpurple.
- */
-#define PURPLE_MINOR_VERSION (@PURPLE_MINOR_VERSION@)
-
-/**
- * PURPLE_MICRO_VERSION:
- *
- * The micro version of the running libpurple.
- */
-#define PURPLE_MICRO_VERSION (@PURPLE_MICRO_VERSION@)
-
-/**
- * PURPLE_EXTRA_VERSION:
- *
- * The "extra" part of the version number if anything.  Typical values are
- * "devel", "beta1", "rc2", etc.
- */
-#define PURPLE_EXTRA_VERSION ("@PURPLE_EXTRA_VERSION@")
-
-/**
- * PURPLE_VERSION
- *
- * The entire version as a string.
- */
-#define PURPLE_VERSION ("@PURPLE_VERSION@")
-
-/**
- * PURPLE_VERSION_CHECK:
- * @major: The major version to check for.
- * @minor: The minor version to check for.
- * @micro: The micro version to check for.
- *
- * Checks the version of libpurple being compiled against.  See
- * #purple_version_check for a runtime check.
- *
- * Returns: %TRUE if the version of libpurple is the same or newer than the
- *          passed-in version.
- */
-#define PURPLE_VERSION_CHECK(major, minor, micro) ((major) == PURPLE_MAJOR_VERSION && \
-                                                   ((minor) < PURPLE_MINOR_VERSION || \
-                                                    ((minor) == PURPLE_MINOR_VERSION && (micro) <= PURPLE_MICRO_VERSION)))
-
-G_BEGIN_DECLS
-
-/**
- * purple_version_check:
- * @required_major: the required major version.
- * @required_minor: the required minor version.
- * @required_micro: the required micro version.
- *
- * Checks that the libpurple version is compatible with the requested
- * version
- *
- * Returns: %NULL if the versions are compatible, or a string describing
- *          the version mismatch if not compatible.
- */
-const char *purple_version_check(guint required_major, guint required_minor, guint required_micro);
-
-/**
- * purple_major_version:
- *
- * The major version of the running libpurple.  Contrast with
- * #PURPLE_MAJOR_VERSION, which expands at compile time to the major version of
- * libpurple being compiled against.
- */
-extern const guint purple_major_version;
-
-/**
- * purple_minor_version:
- *
- * The minor version of the running libpurple.  Contrast with
- * #PURPLE_MINOR_VERSION, which expands at compile time to the minor version of
- * libpurple being compiled against.
- */
-extern const guint purple_minor_version;
-
-/**
- * purple_micro_version:
- *
- * The micro version of the running libpurple.  Contrast with
- * #PURPLE_MICRO_VERSION, which expands at compile time to the micro version of
- * libpurple being compiled against.
- */
-extern const guint purple_micro_version;
-
-G_END_DECLS
-
-#endif /* PURPLE_VERSION_H */
--- a/po/POTFILES.in	Fri Oct 20 01:09:45 2023 -0500
+++ b/po/POTFILES.in	Fri Oct 20 02:10:54 2023 -0500
@@ -228,7 +228,6 @@
 libpurple/tests/test_whiteboard_manager.c
 libpurple/tests/test_xmlnode.c
 libpurple/util.c
-libpurple/version.c
 libpurple/win32/libc_interface.c
 libpurple/win32/win32dep.c
 libpurple/xfer.c

mercurial