Initial commit with empty objects
This commit is contained in:
commit
33fb203538
46
.gitignore
vendored
Normal file
46
.gitignore
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
*.stamp
|
||||||
|
/src/*.o
|
||||||
|
/src/*.lo
|
||||||
|
/src/*.la
|
||||||
|
/src/*.gir
|
||||||
|
/src/*.typelib
|
||||||
|
/aclocal.m4
|
||||||
|
/ar-lib
|
||||||
|
/autom4te.cache
|
||||||
|
/compile
|
||||||
|
/config.guess
|
||||||
|
/config.h
|
||||||
|
/config.h.in
|
||||||
|
/config.log
|
||||||
|
/config.status
|
||||||
|
/config.sub
|
||||||
|
/configure
|
||||||
|
/depcomp
|
||||||
|
/install-sh
|
||||||
|
/libtool
|
||||||
|
/ltmain.sh
|
||||||
|
/missing
|
||||||
|
/src/.deps/
|
||||||
|
.libs/
|
||||||
|
/stamp-h1
|
||||||
|
/gtk-doc.make
|
||||||
|
/m4/
|
||||||
|
/src/matrix-version.h
|
||||||
|
/docs/reference/matrix-glib/version.xml
|
||||||
|
/docs/reference/matrix-glib/html/
|
||||||
|
/docs/reference/matrix-glib/xml/
|
||||||
|
/docs/reference/matrix-glib/matrix-glib-decl-list.txt
|
||||||
|
/docs/reference/matrix-glib/matrix-glib-decl.txt
|
||||||
|
/docs/reference/matrix-glib/matrix-glib-overrides.txt
|
||||||
|
/docs/reference/matrix-glib/matrix-glib-undeclared.txt
|
||||||
|
/docs/reference/matrix-glib/matrix-glib-undocumented.txt
|
||||||
|
/docs/reference/matrix-glib/matrix-glib-unused.txt
|
||||||
|
/docs/reference/matrix-glib/matrix-glib.args
|
||||||
|
/docs/reference/matrix-glib/matrix-glib.hierarchy
|
||||||
|
/docs/reference/matrix-glib/matrix-glib.interfaces
|
||||||
|
/docs/reference/matrix-glib/matrix-glib.prerequisites
|
||||||
|
/docs/reference/matrix-glib/matrix-glib.signals
|
||||||
|
/docs/reference/matrix-glib/matrix-glib.types
|
||||||
|
/docs/reference/matrix-glib/*.bak
|
6
Makefile.am
Normal file
6
Makefile.am
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
SUBDIRS = src
|
||||||
|
|
||||||
|
if ENABLE_GTK_DOC
|
||||||
|
SUBDIRS += docs/reference/matrix-glib
|
||||||
|
endif
|
60
autogen.sh
Executable file
60
autogen.sh
Executable file
@ -0,0 +1,60 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
srcdir=`dirname "$0"`
|
||||||
|
test -z "$srcdir" && srcdir=.
|
||||||
|
|
||||||
|
PKG_NAME="matrix-client-glib"
|
||||||
|
|
||||||
|
(test -f "$srcdir/configure.ac" \
|
||||||
|
&& test -f "$srcdir/src/matrix-client.c") || {
|
||||||
|
echo "**Error**: Directory "\`$srcdir\'" does not look like the"
|
||||||
|
echo " top-level $PKG_NAME directory"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
cd "$srcdir"
|
||||||
|
|
||||||
|
m4dir=`grep '^AC_CONFIG_MACRO_DIR' configure.ac \
|
||||||
|
| sed -n -e 's/AC_CONFIG_MACRO_DIR(\([^()]*\))/\1/p' \
|
||||||
|
| sed -e 's/^\[\(.*\)\]$/\1/' \
|
||||||
|
| sed -e 1q`
|
||||||
|
m4_dir=$m4dir
|
||||||
|
|
||||||
|
if test -n "$m4dir"]; then
|
||||||
|
m4dir="-I $m4dir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running libtoolize"
|
||||||
|
libtoolize --force --copy || exit $?
|
||||||
|
|
||||||
|
GTKDOCIZE=$(which gtkdocize 2>/dev/null)
|
||||||
|
|
||||||
|
if test -z "$GTKDOCIZE"; then
|
||||||
|
echo "You don't have gtk-doc installed, and thus won't be able to generate documentation"
|
||||||
|
rm -f gtk-doc.make
|
||||||
|
rm -f $m4_dir/gtk-doc.m4
|
||||||
|
cat > gtk-doc.make <<EOF
|
||||||
|
EXTRA_DIST =
|
||||||
|
CLEANFILES =
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
echo "Running gtkdocize"
|
||||||
|
gtkdocize --copy || exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running aclocal"
|
||||||
|
aclocal $m4dir $ACLOCAL_FLAGS || exit $?
|
||||||
|
|
||||||
|
echo "Running autoconf"
|
||||||
|
autoconf || exit $?
|
||||||
|
|
||||||
|
if grep '^A[CM]_CONFIG_HEADER' configure.ac > /dev/null; then
|
||||||
|
echo "Running autoheader"
|
||||||
|
autoheader || exit $?
|
||||||
|
test -f config.h.in && touch config.h.in
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running automake"
|
||||||
|
automake --gnu --add-missing --copy -Wno-portability || exit $?
|
||||||
|
|
||||||
|
"$srcdir/configure" "$@"
|
73
configure.ac
Normal file
73
configure.ac
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
m4_define([matrix_glib_minor_version], [0])
|
||||||
|
m4_define([matrix_glib_major_version], [0])
|
||||||
|
m4_define([matrix_glib_micro_version], [1])
|
||||||
|
m4_define([matrix_glib_version], [matrix_glib_major_version.matrix_glib_minor_version.matrix_glib_micro_version])
|
||||||
|
m4_define([matrix_glib_api_version], [matrix_glib_major_version.0])
|
||||||
|
m4_define([matrix_api_version], [0.5.2])
|
||||||
|
|
||||||
|
AC_INIT([MatrixGlib], [matrix_glib_version], [gergely@polonkai.eu], [matrix-glib])
|
||||||
|
AM_INIT_AUTOMAKE([-Wall foreign])
|
||||||
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
AM_SILENT_RULES([yes])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(debug,
|
||||||
|
AC_HELP_STRING([--enable-debug],
|
||||||
|
[compile with debugging support]),
|
||||||
|
[enable_debug=$enableval], [enable_debug=no])
|
||||||
|
|
||||||
|
if test x"$enable_debug" = x"$enableval"; then
|
||||||
|
AC_DEFINE([DEBUG], [1], [Define if debugging should be enabled])
|
||||||
|
|
||||||
|
if test x"$cflags_set" != x"set"; then
|
||||||
|
case " $CFLAGS " in
|
||||||
|
*[[\ \ ]]-g[[\ \ ]]*) ;;
|
||||||
|
*) CFLAGS="$CFLAGS -g" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST([MATRIX_GLIB_MAJOR_VERSION], [matrix_glib_major_version])
|
||||||
|
AC_SUBST([MATRIX_GLIB_MINOR_VERSION], [matrix_glib_minor_version])
|
||||||
|
AC_SUBST([MATRIX_GLIB_MICRO_VERSION], [matrix_glib_micro_version])
|
||||||
|
AC_SUBST([MATRIX_GLIB_VERSION], [matrix_glib_version])
|
||||||
|
AC_SUBST([MATRIX_GLIB_API_VERSION], [matrix_glib_api_version])
|
||||||
|
AC_SUBST([MATRIX_GLIB_API_VERSION_U], [AS_TR_SH([matrix_glib_api_version])])
|
||||||
|
AC_SUBST([MATRIX_API_VERSION], [matrix_api_version])
|
||||||
|
|
||||||
|
AC_PROG_CC
|
||||||
|
AM_PROG_CC_C_O
|
||||||
|
AM_PROG_AR
|
||||||
|
AC_PROG_LIBTOOL
|
||||||
|
LT_INIT
|
||||||
|
|
||||||
|
m4_ifdef([GTK_DOC_CHECK], [
|
||||||
|
GTK_DOC_CHECK([1.20], [--flavour no-tmpl])
|
||||||
|
], [
|
||||||
|
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
|
||||||
|
])
|
||||||
|
|
||||||
|
GOBJECT_INTROSPECTION_CHECK([1.0])
|
||||||
|
|
||||||
|
PKG_PROG_PKG_CONFIG
|
||||||
|
AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.38])
|
||||||
|
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.38])
|
||||||
|
PKG_CHECK_MODULES([SOUP], [libsoup-2.4])
|
||||||
|
|
||||||
|
LIBMATRIX_GLIB_LIBS='$(top_builddir)/src/libmatrix-glib-$(MATRIX_GLIB_API_VERSION).la'
|
||||||
|
AC_SUBST(LIBMATRIX_GLIB_LIBS)
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([
|
||||||
|
Makefile
|
||||||
|
src/Makefile
|
||||||
|
src/matrix-version.h
|
||||||
|
])
|
||||||
|
AM_COND_IF([ENABLE_GTK_DOC], [
|
||||||
|
AC_CONFIG_FILES([
|
||||||
|
docs/reference/matrix-glib/version.xml
|
||||||
|
docs/reference/matrix-glib/Makefile
|
||||||
|
])
|
||||||
|
])
|
||||||
|
AC_OUTPUT
|
103
docs/reference/matrix-glib/Makefile.am
Normal file
103
docs/reference/matrix-glib/Makefile.am
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
# We require automake 1.6 at least.
|
||||||
|
AUTOMAKE_OPTIONS = 1.6
|
||||||
|
|
||||||
|
# This is a blank Makefile.am for using gtk-doc.
|
||||||
|
# Copy this to your project's API docs directory and modify the variables to
|
||||||
|
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
|
||||||
|
# of using the various options.
|
||||||
|
|
||||||
|
# The name of the module, e.g. 'glib'.
|
||||||
|
DOC_MODULE=matrix-glib
|
||||||
|
|
||||||
|
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
|
||||||
|
DOC_MODULE_VERSION=$(MATRIX_GLIB_API_VERSION)
|
||||||
|
|
||||||
|
|
||||||
|
# The top-level XML file (SGML in the past). You can change this if you want to.
|
||||||
|
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml
|
||||||
|
|
||||||
|
# Directories containing the source code.
|
||||||
|
# gtk-doc will search all .c and .h files beneath these paths
|
||||||
|
# for inline comments documenting functions and macros.
|
||||||
|
# e.g. DOC_SOURCE_DIR=$(top_srcdir)/gtk $(top_srcdir)/gdk
|
||||||
|
DOC_SOURCE_DIR=$(top_srcdir)/src
|
||||||
|
|
||||||
|
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
|
||||||
|
SCANGOBJ_OPTIONS=
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-scan.
|
||||||
|
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
|
||||||
|
SCAN_OPTIONS=--rebuild-types --deprecated-guards="MATRIX_DISABLE_DEPRECATED"
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-mkdb.
|
||||||
|
# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml
|
||||||
|
MKDB_OPTIONS=--xml-mode --output-format=xml
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-mktmpl
|
||||||
|
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
|
||||||
|
MKTMPL_OPTIONS=
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-mkhtml
|
||||||
|
MKHTML_OPTIONS=
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-fixref. Not normally needed.
|
||||||
|
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
|
||||||
|
FIXXREF_OPTIONS=
|
||||||
|
|
||||||
|
# Used for dependencies. The docs will be rebuilt if any of these change.
|
||||||
|
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
|
||||||
|
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
|
||||||
|
HFILE_GLOB=$(top_srcdir)/src/*.h
|
||||||
|
CFILE_GLOB=$(top_srcdir)/src/*.c
|
||||||
|
|
||||||
|
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
|
||||||
|
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
|
||||||
|
EXTRA_HFILES=
|
||||||
|
|
||||||
|
# Header files or dirs to ignore when scanning. Use base file/dir names
|
||||||
|
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code
|
||||||
|
IGNORE_HFILES =
|
||||||
|
|
||||||
|
# Images to copy into HTML directory.
|
||||||
|
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
|
||||||
|
HTML_IMAGES=
|
||||||
|
|
||||||
|
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
|
||||||
|
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
|
||||||
|
content_files=
|
||||||
|
|
||||||
|
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
|
||||||
|
# These files must be listed here *and* in content_files
|
||||||
|
# e.g. expand_content_files=running.sgml
|
||||||
|
expand_content_files=
|
||||||
|
|
||||||
|
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
|
||||||
|
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
|
||||||
|
# signals and properties.
|
||||||
|
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
|
||||||
|
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
|
||||||
|
GTKDOC_CFLAGS=
|
||||||
|
GTKDOC_LIBS=$(LIBMATRIX_GLIB_LIBS) $(NULL)
|
||||||
|
|
||||||
|
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||||
|
include $(top_srcdir)/gtk-doc.make
|
||||||
|
|
||||||
|
# Other files to distribute
|
||||||
|
# e.g. EXTRA_DIST += version.xml.in
|
||||||
|
EXTRA_DIST += version.xml.in
|
||||||
|
|
||||||
|
# Files not to distribute
|
||||||
|
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
|
||||||
|
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
|
||||||
|
DISTCLEANFILES = $(DOC_MODULE).types
|
||||||
|
|
||||||
|
# Comment this out if you want 'make check' to test you doc status
|
||||||
|
# and run some sanity checks
|
||||||
|
if ENABLE_GTK_DOC
|
||||||
|
TESTS_ENVIRONMENT = cd $(srcdir) && \
|
||||||
|
DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
|
||||||
|
SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
|
||||||
|
#TESTS = $(GTKDOC_CHECK)
|
||||||
|
endif
|
40
docs/reference/matrix-glib/matrix-glib-docs.xml
Normal file
40
docs/reference/matrix-glib/matrix-glib-docs.xml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
|
||||||
|
[
|
||||||
|
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
|
||||||
|
<!ENTITY version SYSTEM "version.xml">
|
||||||
|
<!ENTITY server "gergely.polonkai.eu">
|
||||||
|
]>
|
||||||
|
<book id="index">
|
||||||
|
<bookinfo>
|
||||||
|
<title>Matrix.org GLib SDK Reference Manual</title>
|
||||||
|
<releaseinfo>
|
||||||
|
for Matrix.org GLib SDK &version;.
|
||||||
|
The latest version of this documentation can be found on-line at
|
||||||
|
<ulink role="online-location" url="http://&server;/matrix-glib-sdk/index.html">http://&server;/matrix-glib-sdk/</ulink>.
|
||||||
|
</releaseinfo>
|
||||||
|
</bookinfo>
|
||||||
|
|
||||||
|
<chapter>
|
||||||
|
<title>Matrix Client</title>
|
||||||
|
<xi:include href="xml/matrix-client.xml"/>
|
||||||
|
<xi:include href="xml/matrix-api.xml"/>
|
||||||
|
<xi:include href="xml/matrix-version.xml"/>
|
||||||
|
|
||||||
|
</chapter>
|
||||||
|
<chapter id="object-tree">
|
||||||
|
<title>Object Hierarchy</title>
|
||||||
|
<xi:include href="xml/tree_index.sgml"/>
|
||||||
|
</chapter>
|
||||||
|
<index id="api-index-full">
|
||||||
|
<title>API Index</title>
|
||||||
|
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
|
||||||
|
</index>
|
||||||
|
<index id="deprecated-api-index" role="deprecated">
|
||||||
|
<title>Index of deprecated API</title>
|
||||||
|
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
|
||||||
|
</index>
|
||||||
|
|
||||||
|
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||||
|
</book>
|
41
docs/reference/matrix-glib/matrix-glib-sections.txt
Normal file
41
docs/reference/matrix-glib/matrix-glib-sections.txt
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<SECTION>
|
||||||
|
<FILE>matrix-client</FILE>
|
||||||
|
<TITLE>MatrixClient</TITLE>
|
||||||
|
matrix_client_new
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
MatrixClient
|
||||||
|
MatrixClientClass
|
||||||
|
MATRIX_IS_CLIENT
|
||||||
|
MATRIX_IS_CLIENT_CLASS
|
||||||
|
MATRIX_CLIENT
|
||||||
|
MATRIX_CLIENT_CLASS
|
||||||
|
MATRIX_CLIENT_GET_CLASS
|
||||||
|
MATRIX_TYPE_CLIENT
|
||||||
|
MatrixClientPrivate
|
||||||
|
matrix_client_get_type
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>matrix-api</FILE>
|
||||||
|
<TITLE>MatrixAPI</TITLE>
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
MatrixAPI
|
||||||
|
MatrixAPIClass
|
||||||
|
MATRIX_IS_API
|
||||||
|
MATRIX_IS_API_CLASS
|
||||||
|
MATRIX_API
|
||||||
|
MATRIX_API_CLASS
|
||||||
|
MATRIX_API_GET_CLASS
|
||||||
|
MATRIX_TYPE_API
|
||||||
|
MatrixApiPrivate
|
||||||
|
matrix_api_get_type
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>matrix-version</FILE>
|
||||||
|
MATRIX_GLIB_MAJOR_VERSION
|
||||||
|
MATRIX_GLIB_MINOR_VERSION
|
||||||
|
MATRIX_GLIB_MICRO_VERSION
|
||||||
|
MATRIX_GLIB_CHECK_VERSION
|
||||||
|
matrix_glib_check_version
|
||||||
|
</SECTION>
|
1
docs/reference/matrix-glib/version.xml.in
Normal file
1
docs/reference/matrix-glib/version.xml.in
Normal file
@ -0,0 +1 @@
|
|||||||
|
@MATRIX_GLIB_API_VERSION@
|
49
src/Makefile.am
Normal file
49
src/Makefile.am
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Matrix-GLib\"
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libmatrix-glib-0.0.la
|
||||||
|
|
||||||
|
INST_H_SRC_FILES = \
|
||||||
|
matrix-client.h \
|
||||||
|
matrix-api.h \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
INST_H_BUILT_FILES = matrix-version.h
|
||||||
|
|
||||||
|
libmatrix_glib_0_0_la_SOURCES = \
|
||||||
|
matrix-client.c \
|
||||||
|
matrix-version.c \
|
||||||
|
matrix-api.c \
|
||||||
|
$(INST_H_SRC_FILES) \
|
||||||
|
$(INST_H_BUILT_FILES) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
libmatrix_glib_0_0_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) $(SOUP_CFLAGS)
|
||||||
|
libmatrix_glib_0_0_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) $(SOUP_LIBS)
|
||||||
|
libmatrix_glib_0_0_la_DEPENDENCIES =
|
||||||
|
|
||||||
|
CLEANFILES =
|
||||||
|
EXTRA_DIST = $(INST_H_SRC_FILES)
|
||||||
|
|
||||||
|
include $(INTROSPECTION_MAKEFILE)
|
||||||
|
MatrixGlib-$(MATRIX_GLIB_API_VERSION).gir: libmatrix-glib-0.0.la
|
||||||
|
Matrix_@MATRIX_GLIB_API_VERSION_U@_gir_FILES = $(INST_H_SRC_FILES) $(INST_H_BUILT_FILES) $(filter %.c,$(libmatrix_glib_0_0_la_SOURCES))
|
||||||
|
Matrix_@MATRIX_GLIB_API_VERSION_U@_gir_LIBS = libmatrix-glib-0.0.la
|
||||||
|
Matrix_@MATRIX_GLIB_API_VERSION_U@_gir_SCANNERFLAGS = --identifier-prefix=Matrix --symbol-prefix=matrix --warn-all
|
||||||
|
Matrix_@MATRIX_GLIB_API_VERSION_U@_gir_INCLUDES = GLib-2.0 GObject-2.0 Soup-2.4
|
||||||
|
Matrix_@MATRIX_GLIB_API_VERSION_U@_gir_CFLAGS = -D__MATRIX_GLIB_BUILDING__ -I$(top_srcdir) -I$(srcdir) -I$(builddir)
|
||||||
|
Matrix_@MATRIX_GLIB_API_VERSION_U@_gir_EXPORT_PACKAGES = matrix-glib
|
||||||
|
INTROSPECTION_GIRS = Matrix-$(MATRIX_GLIB_API_VERSION).gir
|
||||||
|
|
||||||
|
girdir = $(datadir)/gir-1.0
|
||||||
|
gir_DATA = Matrix-$(MATRIX_GLIB_API_VERSION).gir
|
||||||
|
|
||||||
|
typelibsdir = $(libdir)/girepository-1.0
|
||||||
|
typelibs_DATA = Matrix-$(MATRIX_GLIB_API_VERSION).typelib
|
||||||
|
|
||||||
|
headerdir = $(includedir)/swe-glib
|
||||||
|
header_DATA = \
|
||||||
|
$(INST_H_SRC_FILES) \
|
||||||
|
$(INST_H_BUILT_FILES) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
CLEANFILES += $(gir_DATA) $(typelibs_DATA)
|
185
src/matrix-api.c
Normal file
185
src/matrix-api.c
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of matrix-glib-sdk
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk is free software: you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with matrix-glib-sdk. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "matrix-api.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <libsoup/soup.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:matrix-api
|
||||||
|
* @short_description: Low level API calls to communicate with a
|
||||||
|
* Matrix.org server
|
||||||
|
* @title: MatrixAPI
|
||||||
|
* @stability: Unstable
|
||||||
|
* @include: matrix-glib/matrix.h
|
||||||
|
*
|
||||||
|
* This is a class for low level communication with a Matrix.org
|
||||||
|
* server.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MatrixAPI:
|
||||||
|
*
|
||||||
|
* The MatrixAPI object’s instance definition.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MatrixAPIClass:
|
||||||
|
* @parent_class: the parent class structure (#GObjectClass)
|
||||||
|
*
|
||||||
|
* The MatrixAPI object’s class definition.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define API_ENDPOINT "/_matrix/client/api/v1"
|
||||||
|
|
||||||
|
typedef struct _MatrixAPIPrivate {
|
||||||
|
SoupSession *soup_session;
|
||||||
|
guint txn_id;
|
||||||
|
gchar *url;
|
||||||
|
gchar *token;
|
||||||
|
gboolean validate_cert;
|
||||||
|
} MatrixAPIPrivate;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_URL = 1,
|
||||||
|
N_PROPERTIES
|
||||||
|
};
|
||||||
|
|
||||||
|
GParamSpec *obj_properties[N_PROPERTIES] = {NULL,};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_PRIVATE(MatrixAPI, matrix_api, G_TYPE_OBJECT);
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_api_finalize(GObject *gobject)
|
||||||
|
{
|
||||||
|
g_signal_handlers_destroy(gobject);
|
||||||
|
G_OBJECT_CLASS(matrix_api_parent_class)->finalize(gobject);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_api_set_property(GObject *gobject,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
MatrixAPI *api = MATRIX_API(gobject);
|
||||||
|
MatrixAPIPrivate *priv = matrix_api_get_instance_private(api);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_URL:
|
||||||
|
{
|
||||||
|
const gchar *base_url;
|
||||||
|
gchar *last_occurence;
|
||||||
|
|
||||||
|
base_url = g_value_get_string(value);
|
||||||
|
|
||||||
|
if (!g_str_is_ascii(base_url)) {
|
||||||
|
g_warning("URL specified (%s) is not ASCII", base_url);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
last_occurence = g_strrstr(base_url, API_ENDPOINT);
|
||||||
|
|
||||||
|
if ((g_strcmp0(last_occurence, API_ENDPOINT) == 0) ||
|
||||||
|
(g_strcmp0(last_occurence, API_ENDPOINT"/") == 0)) {
|
||||||
|
priv->url = g_strdup(base_url);
|
||||||
|
} else {
|
||||||
|
priv->url = g_strdup_printf(
|
||||||
|
"%s%s%s",
|
||||||
|
base_url,
|
||||||
|
(base_url[strlen(base_url) - 1] == '/') ? "" : "/",
|
||||||
|
API_ENDPOINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_api_get_property(GObject *gobject,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
MatrixAPI *api = MATRIX_API(gobject);
|
||||||
|
MatrixAPIPrivate *priv = matrix_api_get_instance_private(api);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_URL:
|
||||||
|
g_value_set_string(value, priv->url);
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_api_class_init(MatrixAPIClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
|
||||||
|
|
||||||
|
gobject_class->set_property = matrix_api_set_property;
|
||||||
|
gobject_class->get_property = matrix_api_get_property;
|
||||||
|
gobject_class->finalize = matrix_api_finalize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MatrixAPI:url:
|
||||||
|
*
|
||||||
|
* The base URL to use for communication with the Matrix.org
|
||||||
|
* server.
|
||||||
|
*/
|
||||||
|
obj_properties[PROP_URL] = g_param_spec_string(
|
||||||
|
"url", "Server URL",
|
||||||
|
"Matrix.org home server to connect to.",
|
||||||
|
NULL,
|
||||||
|
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
g_object_class_install_properties(gobject_class,
|
||||||
|
N_PROPERTIES,
|
||||||
|
obj_properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_api_init(MatrixAPI *api)
|
||||||
|
{
|
||||||
|
MatrixAPIPrivate *priv = matrix_api_get_instance_private(api);
|
||||||
|
|
||||||
|
priv->txn_id = 0;
|
||||||
|
priv->url = NULL;
|
||||||
|
priv->token = NULL;
|
||||||
|
priv->validate_cert = TRUE;
|
||||||
|
priv->soup_session = soup_session_new_with_options(
|
||||||
|
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_SNIFFER,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
MatrixAPI *
|
||||||
|
matrix_api_new(const gchar *base_url, const gchar *token)
|
||||||
|
{
|
||||||
|
return g_object_new(MATRIX_TYPE_API,
|
||||||
|
"base-url", base_url,
|
||||||
|
"token", token,
|
||||||
|
NULL);
|
||||||
|
}
|
51
src/matrix-api.h
Normal file
51
src/matrix-api.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of matrix-glib-sdk
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk is free software: you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with matrix-glib-sdk. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MATRIX_API_H__
|
||||||
|
#define __MATRIX_API_H__
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define MATRIX_TYPE_API (matrix_api_get_type())
|
||||||
|
#define MATRIX_API(o) (G_TYPE_CHECK_INSTANCE_CAST((o), MATRIX_TYPE_API, MatrixAPI))
|
||||||
|
#define MATRIX_API_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MATRIX_TYPE_API, MatrixAPIClass))
|
||||||
|
#define MATRIX_IS_API(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), MATRIX_TYPE_API))
|
||||||
|
#define MATRIX_IS_API_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), MATRIX_TYPE_API))
|
||||||
|
#define MATRIX_API_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MATRIX_TYPE_API, MatrixAPIClass))
|
||||||
|
|
||||||
|
typedef struct _MatrixAPI MatrixAPI;
|
||||||
|
typedef struct _MatrixAPIClass MatrixAPIClass;
|
||||||
|
|
||||||
|
struct _MatrixAPI {
|
||||||
|
/* Parent instance structure */
|
||||||
|
GObject parent_instance;
|
||||||
|
|
||||||
|
/* Instance members */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MatrixAPIClass {
|
||||||
|
GObjectClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType matrix_api_get_type(void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __MATRIX_API_H__ */
|
177
src/matrix-client.c
Normal file
177
src/matrix-client.c
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of matrix-glib-sdk
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk is free software: you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with matrix-glib-sdk. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "matrix-client.h"
|
||||||
|
#include "matrix-api.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:matrix-client
|
||||||
|
* @short_description: Base class for communication with a Matrix.org server
|
||||||
|
* @title: MatrixClient
|
||||||
|
* @stability: Unstable
|
||||||
|
* @include: matrix-glib/matrix.h
|
||||||
|
*
|
||||||
|
* This is the base class for client communication with a Matrix.org server.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MatrixClient:
|
||||||
|
*
|
||||||
|
* The MatrixClient object’s instance definition.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MatrixClientClass:
|
||||||
|
* @parent_class: the parent class structure (#GObjectClass)
|
||||||
|
*
|
||||||
|
* The MatrixClient object’s class definition.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _MatrixClientPrivate {
|
||||||
|
MatrixAPI *api;
|
||||||
|
} MatrixClientPrivate;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_PRIVATE(MatrixClient, matrix_client, G_TYPE_OBJECT);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_HOMESERVER = 1,
|
||||||
|
PROP_TOKEN,
|
||||||
|
N_PROPERTIES
|
||||||
|
};
|
||||||
|
|
||||||
|
static GParamSpec *obj_properties[N_PROPERTIES] = {NULL,};
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_client_finalize(GObject *gobject)
|
||||||
|
{
|
||||||
|
g_signal_handlers_destroy(gobject);
|
||||||
|
G_OBJECT_CLASS(matrix_client_parent_class)->finalize(gobject);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_client_dispose(GObject *gobject)
|
||||||
|
{
|
||||||
|
MatrixClientPrivate *priv = matrix_client_get_instance_private(
|
||||||
|
MATRIX_CLIENT(gobject));
|
||||||
|
|
||||||
|
g_clear_object(&priv->api);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS(matrix_client_parent_class)->dispose(gobject);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_client_set_property(GObject *gobject,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_HOMESERVER:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_client_get_property(GObject *gobject,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_HOMESERVER:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_client_class_init(MatrixClientClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
|
||||||
|
|
||||||
|
gobject_class->set_property = matrix_client_set_property;
|
||||||
|
gobject_class->get_property = matrix_client_get_property;
|
||||||
|
gobject_class->finalize = matrix_client_finalize;
|
||||||
|
gobject_class->dispose = matrix_client_dispose;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MatrixClient:homeserver:
|
||||||
|
*
|
||||||
|
* The address of the home server to connect to.
|
||||||
|
*/
|
||||||
|
obj_properties[PROP_HOMESERVER] = g_param_spec_string(
|
||||||
|
"homeserver", "Home server",
|
||||||
|
"Matrix.org home server to connect to",
|
||||||
|
NULL,
|
||||||
|
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MatrixClient:token:
|
||||||
|
*
|
||||||
|
* The token to use for authorization.
|
||||||
|
*/
|
||||||
|
obj_properties[PROP_TOKEN] = g_param_spec_string(
|
||||||
|
"token", "Token",
|
||||||
|
"Authentication token to use",
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
g_object_class_install_properties(gobject_class,
|
||||||
|
N_PROPERTIES,
|
||||||
|
obj_properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
matrix_client_init(MatrixClient *client)
|
||||||
|
{
|
||||||
|
MatrixClientPrivate *priv = matrix_client_get_instance_private(client);
|
||||||
|
|
||||||
|
priv->api = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* matrix_client_new:
|
||||||
|
* @homeserver: the home server to connect to
|
||||||
|
* @token: (allow-none): the authentication token to use
|
||||||
|
*
|
||||||
|
* Creates a new #MatrixClient instance for the specified home
|
||||||
|
* server. The token, if specified, will be used for authorization
|
||||||
|
* throughout communication with that server. The token gets
|
||||||
|
* autogenerated by matrix_client_login_password() and
|
||||||
|
* matrix_client_register_password(). No other communication is
|
||||||
|
* allowed with the server before the token is set.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): a new #MatrixClient instance
|
||||||
|
*/
|
||||||
|
MatrixClient *
|
||||||
|
matrix_client_new(const gchar *homeserver, const gchar *token)
|
||||||
|
{
|
||||||
|
return g_object_new(MATRIX_TYPE_CLIENT,
|
||||||
|
"homeserver", homeserver,
|
||||||
|
"token", token,
|
||||||
|
NULL);
|
||||||
|
}
|
53
src/matrix-client.h
Normal file
53
src/matrix-client.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of matrix-glib-sdk
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk is free software: you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with matrix-glib-sdk. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MATRIX_CLIENT_H__
|
||||||
|
#define __MATRIX_CLIENT_H__
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define MATRIX_TYPE_CLIENT (matrix_client_get_type())
|
||||||
|
#define MATRIX_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), MATRIX_TYPE_CLIENT, MatrixClient))
|
||||||
|
#define MATRIX_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MATRIX_TYPE_CLIENT, MatrixClientClass))
|
||||||
|
#define MATRIX_IS_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), MATRIX_TYPE_CLIENT))
|
||||||
|
#define MATRIX_IS_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), MATRIX_TYPE_CLIENT))
|
||||||
|
#define MATRIX_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MATRIX_TYPE_CLIENT, MatrixClientClass))
|
||||||
|
|
||||||
|
typedef struct _MatrixClient MatrixClient;
|
||||||
|
typedef struct _MatrixClientClass MatrixClientClass;
|
||||||
|
|
||||||
|
struct _MatrixClient {
|
||||||
|
/* Parent instance structure */
|
||||||
|
GObject parent_instance;
|
||||||
|
|
||||||
|
/* Instance members */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MatrixClientClass {
|
||||||
|
/* Parent class */
|
||||||
|
GObjectClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType matrix_client_get_type(void) G_GNUC_CONST;
|
||||||
|
MatrixClient *matrix_client_new(const gchar *homeserver, const gchar *token);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __MATRIX_CLIENT_H__ */
|
79
src/matrix-version.c
Normal file
79
src/matrix-version.c
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of matrix-glib-sdk
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk is free software: you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with matrix-glib-sdk. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "matrix-version.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:matrix-version
|
||||||
|
* @short_description: Matrix.org GLib SDK version information
|
||||||
|
* @title: Version information
|
||||||
|
* @stability: Stable
|
||||||
|
* @include: matrix-client/matrix-client.h
|
||||||
|
*
|
||||||
|
* Version information for the Matrix.org GLib SDK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MATRIX_GLIB_MAJOR_VERSION:
|
||||||
|
*
|
||||||
|
* The major version number of the Matrix.org GLib SDK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MATRIX_GLIB_MINOR_VERSION:
|
||||||
|
*
|
||||||
|
* The minor version number of the Matrix.org GLib SDK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MATRIX_GLIB_MICRO_VERSION:
|
||||||
|
*
|
||||||
|
* The micro (patch) version number of the Matrix.org GLib SDK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MATRIX_GLIB_CHECK_VERSION:
|
||||||
|
* @major: the major version to check for
|
||||||
|
* @minor: the minor version to check for
|
||||||
|
* @micro: the micro version to check for
|
||||||
|
*
|
||||||
|
* Checks the version number of the Matrix.org GLib SDK that is being
|
||||||
|
* compiled against.
|
||||||
|
*
|
||||||
|
* Returns: TRUE if the required version is satisfied; FALSE otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* matrix_glib_check_version:
|
||||||
|
* @required_major: the required major version
|
||||||
|
* @required_minor: the required minor version
|
||||||
|
* @required_micro: the required micro version
|
||||||
|
*
|
||||||
|
* Check that the Matrix.org GLib SDK in use is compatible with the
|
||||||
|
* given version.
|
||||||
|
*
|
||||||
|
* Returns: TRUE if the required version is satisfied; FALSE otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
matrix_glib_check_version(guint required_major,
|
||||||
|
guint required_minor,
|
||||||
|
guint required_micro)
|
||||||
|
{
|
||||||
|
return MATRIX_GLIB_CHECK_VERSION(required_major, required_minor, required_micro);
|
||||||
|
}
|
38
src/matrix-version.h.in
Normal file
38
src/matrix-version.h.in
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of matrix-glib-sdk
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk is free software: you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* matrix-glib-sdk 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with matrix-glib-sdk. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MATRIX_VERSION_H__
|
||||||
|
#define __MATRIX_VERSION_H__
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#define MATRIX_GLIB_MAJOR_VERSION @MATRIX_GLIB_MAJOR_VERSION@
|
||||||
|
#define MATRIX_GLIB_MINOR_VERSION @MATRIX_GLIB_MINOR_VERSION@
|
||||||
|
#define MATRIX_GLIB_MICRO_VERSION @MATRIX_GLIB_MICRO_VERSION@
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
matrix_glib_check_version(guint required_major,
|
||||||
|
guint required_minor,
|
||||||
|
guint required_micro);
|
||||||
|
|
||||||
|
#define MATRIX_GLIB_CHECK_VERSION(major, minor, micro) \
|
||||||
|
(MATRIX_GLIB_MAJOR_VERSION > (major) || \
|
||||||
|
(MATRIX_GLIB_MAJOR_VERSION == (major) && MATRIX_GLIB_MINOR_VERSION > (minor)) || \
|
||||||
|
(MATRIX_GLIB_MAJOR_VERSION == (major) && MATRIX_GLIB_MINOR_VERSION == (minor) && MATRIX_GLIB_MICRO_VERSION >= (micro)))
|
||||||
|
|
||||||
|
#endif /* __MATRIX_VERSION_H__ */
|
Loading…
Reference in New Issue
Block a user