commit b060ac5a76510c0b69ba730b4db1c09874659528 Author: Gergely Polonkai Date: Fri Dec 4 15:39:39 2015 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7d721f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,79 @@ +*.swp +*~ + +/INSTALL +aclocal.m4 +autom4te.cache +/build-aux +config.guess +config.cache +config.h +config.h.in +config.log +config.status +config.sub +configure +install-sh +libtool +ltmain.sh +missing +stamp-h1 +depcomp +compile +/test-driver + +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 + +Makefile +Makefile.in + +.deps +.libs + +*.o +*.lo +*.la +*.pyc + +*-glue.[ch] +*-marshal.[ch] +*-enumtypes.[ch] +*-bindings.[ch] +*-gen.h + +data/org.freedesktop.Telepathy.ConnectionManager.matrix.service + +extensions/_gen +extensions/extensions.html + +src/telepathy-matrix +src/telepathy-matrix.8 + +core +cscope.out +tags + +tests/test-ctcp-kill-blingbling +tests/test-ctcp-tokenize +tests/test-text-encode-and-split +tests/test-tokenize-leading-space +tests/test-tokenize-leading-space.c +tests/*.log +tests/*.trs + +tests/twisted/config.py +tests/twisted/matrix-twisted-tests.list +tests/twisted/tools/exec-with-log.sh +tests/twisted/tools/matrix-testing.log +tests/twisted/tools/org.freedesktop.Telepathy.ConnectionManager.matrix.service +tests/twisted/run-test.sh +tests/twisted/test-suite.log +tests/twisted/tools/tmp-session-bus.conf + +tests/twisted/with-session-bus*.dbus-monitor-logs +tests/twisted/with-session-bus*.address +tests/twisted/with-session-bus*.pid diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..cf11a46 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Author: +Gergely Polonkai diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/COPYING @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..b3926f3 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,11 @@ +ACLOCAL_AMFLAGS = -I m4 + +#SUBDIRS = tools extensions src data m4 tests +SUBDIRS = src + +#check-twisted : all +# $(MAKE) -C tests/twisted check-twisted + +#check-all: check check-twisted + +include tools/telepathy.am diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 120000 index 0000000..42061c0 --- /dev/null +++ b/README @@ -0,0 +1 @@ +README.md \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c4e9af --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Telepathy connection manager for Matrix.org + +Telepathy Matrix implements the +[Telepathy](http://telepathy.freedesktop.org/wiki/) +[D-Bus](http://www.freedesktop.org/wiki/Software/dbus/) specification +for the [Matrix.org](http://matrix.org/) SDK, allowing Telepathy +clients like +[Empathy](https://wiki.gnome.org/action/show/Apps/Empathy) to connect +to Matrix.org home servers. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..381e32f --- /dev/null +++ b/autogen.sh @@ -0,0 +1,24 @@ +#!/bin/sh +set -e + +autoreconf -i -Wno-portability + +# Honor NOCONFIGURE for compatibility with gnome-autogen.sh +if test x"$NOCONFIGURE" = x; then + run_configure=true + for arg in $*; do + case $arg in + --no-configure) + run_configure=false + ;; + *) + ;; + esac + done +else + run_configure=false +fi + +if test $run_configure = true; then + ./configure "$@" +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..c077915 --- /dev/null +++ b/configure.ac @@ -0,0 +1,142 @@ +AC_PREREQ([2.60]) + +# Making releases: +# set the new version number: +# odd minor -> development series +# even minor -> stable series +# increment micro for each release within a series +# set nano_version to 0 +# make the release, tag it +# set nano_version to 1 + +m4_define([matrix_major_version], [0]) +m4_define([matrix_minor_version], [0]) +m4_define([matrix_micro_version], [0]) +m4_define([matrix_nano_version], [1]) + +m4_define([matrix_base_version], + [matrix_major_version.matrix_minor_version.matrix_micro_version]) +m4_define([matrix_version], + [m4_if(matrix_nano_version, 0, + [matrix_base_version], + [matrix_base_version].[matrix_nano_version])]) + +AC_INIT([telepathy-matrix], [matrix_version]) + +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([build-aux]) + +# Enable silent build rules by default, requires at least +# Automake-1.11. Disable by either passing --disable-silent-rules to +# configure or passing V=1 to make +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +AM_INIT_AUTOMAKE([1.9 -Wno-portability subdir-objects]) + +AM_PROG_LIBTOOL +AM_CONFIG_HEADER(config.h) +AC_PROG_MKDIR_P + +dnl check for tools +AC_PROG_CC +AC_PROG_CC_STDC +AM_PROG_AS + +AS_IF([test matrix_nano_version = 0], +[ # version x.y.z - "official release", + # disable extra checks by default + AC_ARG_ENABLE([fatal-warnings], + [AC_HELP_STRING([--enable-fatal-warnings], + [make various warnings fatal])], + [], + [enable_fatal_warnings=no]) +], +[ # version x.y.z.1 - development snapshot, + # enable extra checks by default + AC_ARG_ENABLE([fatal-warnings], + [AC_HELP_STRING([--disable-fatal-warnings], + [make various warnings non-fatal])], + [], + [enable_fatal_warnings=yes]) +]) + +TP_COMPILER_WARNINGS([ERROR_CFLAGS], [test "x$enable_fatal_warnings" = xyes], + [all \ + extra \ + declaration-after-statement \ + shadow \ + missing-prototypes \ + nested-externs \ + pointer-arith \ + sign-compare \ + strict-prototypes \ + format-security \ + init-self], + [missing-field-initializers \ + unused-parameter]) +AC_SUBST([ERROR_CFLAGS]) + +# these aren't really error flags but they serve a similar purpose for us - +# making the toolchain stricter +AS_IF([test "x$enable_fatal_warnings" = xyes], + [TP_ADD_LINKER_FLAG([ERROR_LDFLAGS], [-Wl,--no-copy-dt-needed-entries])]) + +AC_HEADER_STDC([]) +AC_C_INLINE + +AC_DEFINE(GLIB_VERSION_MIN_REQUIRED, GLIB_VERSION_2_28, [Ignore post 2.28 deprecations]) +AC_DEFINE(GLIB_VERSION_MAX_ALLOWED, GLIB_VERSION_2_32, [Prevent post 2.32 APIs]) + +PKG_CHECK_MODULES([GLIB], + [glib-2.0 >= 2.32.0, gobject-2.0 >= 2.32.0, gio-2.0 >= 2.32.0 ]) + +PKG_CHECK_MODULES([DBUS], [dbus-1 >= 0.51, dbus-glib-1 >= 0.51]) + +AC_DEFINE([TP_SEAL_ENABLE], [], [Prevent to use sealed variables]) +AC_DEFINE([TP_DISABLE_SINGLE_INCLUDE], [], [Disable single header include]) +AC_DEFINE(TP_VERSION_MIN_REQUIRED, TP_VERSION_0_22, [Ignore post 0.22 deprecations]) +AC_DEFINE(TP_VERSION_MAX_ALLOWED, TP_VERSION_0_22, [Prevent post 0.22 APIs]) +PKG_CHECK_MODULES([TELEPATHY], [telepathy-glib >= 0.21]) + +dnl Check for code generation tools +XSLTPROC= +AC_CHECK_PROGS([XSLTPROC], [xsltproc]) +AS_IF([test -z "$XSLTPROC"], + [AC_MSG_ERROR([xsltproc (from the libxslt source package) is required])]) + +AM_PATH_PYTHON([2.3]) + +dnl check for a version of python that can run the twisted tests +AC_MSG_CHECKING([for Python with Twisted and IRC protocol support]) +for TEST_PYTHON in python2.5 python2.6 python; do + AS_IF([$TEST_PYTHON -c "from sys import version_info; import dbus, dbus.mainloop.glib; raise SystemExit(version_info < (2, 5, 0, 'final', 0))" >/dev/null 2>&1], + [ + AS_IF([$TEST_PYTHON -c "import twisted.words.protocols.irc, twisted.internet.reactor" >/dev/null 2>&1], + [ + AM_CONDITIONAL([WANT_TWISTED_TESTS], [true]) + break + ], + [TEST_PYTHON=no]) + ]) +done +AC_MSG_RESULT([$TEST_PYTHON]) +AC_SUBST(TEST_PYTHON) +AM_CONDITIONAL([WANT_TWISTED_TESTS], test xno != x$TEST_PYTHON) + + +AS_AC_EXPAND(DATADIR, $datadir) +DBUS_SERVICES_DIR="$DATADIR/dbus-1/services" +AC_SUBST(DBUS_SERVICES_DIR) +AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [DBus services directory]) + +AC_CHECK_FUNCS(strnlen) + +AC_OUTPUT( Makefile \ + data/Makefile \ + m4/Makefile \ + src/Makefile \ +dnl tests/Makefile \ +dnl tests/twisted/Makefile \ +dnl tests/twisted/tools/Makefile \ + tools/Makefile \ +) diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..3547bba --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,19 @@ +# Telepathy manager file +managerdir = $(datadir)/telepathy/managers +manager_DATA = matrix.manager + +# Dbus service file +BUILT_FILES = $(service_in_files:.service.in=.service) + +servicedir = $(DBUS_SERVICES_DIR) +service_in_files = org.freedesktop.Telepathy.ConnectionManager.matrix.service.in +service_DATA = $(BUILT_FILES) +CLEANFILES = $(BUILT_FILES) + +# Rule to make the service file with libexecdir expanded +$(service_DATA): $(service_in_files) Makefile + @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ + +EXTRA_DIST= \ + ${service_in_files} \ + ${manager_DATA} diff --git a/data/matrix.manager b/data/matrix.manager new file mode 100644 index 0000000..034a789 --- /dev/null +++ b/data/matrix.manager @@ -0,0 +1,22 @@ +[ConnectionManager] +Name = matrix +BusName = org.freedesktop.Telepathy.ConnectionManager.matrix +ObjectPath = /org/freedesktop/Telepathy/ConnectionManager/matrix + +[Protocol matrix] +param-account = s required +param-server = s required +param-fullname = s +param-username = s +param-port = q +param-password = s secret +param-charset = s +param-keepalive-interval = u +param-quit-message = s +param-use-ssl = b +param-password-prompt = b +default-port = 8448 +default-charset = UTF-8 +default-keepalive-interval = 30 +default-use-ssl = true +default-password-prompt = true diff --git a/data/org.freedesktop.Telepathy.ConnectionManager.matrix.service.in b/data/org.freedesktop.Telepathy.ConnectionManager.matrix.service.in new file mode 100644 index 0000000..cb4b55c --- /dev/null +++ b/data/org.freedesktop.Telepathy.ConnectionManager.matrix.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.freedesktop.Telepathy.ConnectionManager.matrix +Exec=@libexecdir@/telepathy-matrix diff --git a/m4/Makefile.am b/m4/Makefile.am new file mode 100644 index 0000000..259e3c3 --- /dev/null +++ b/m4/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = \ +as-compiler-flag.m4 \ +as-version.m4 \ +as-ac-expand.m4 diff --git a/m4/as-ac-expand.m4 b/m4/as-ac-expand.m4 new file mode 100644 index 0000000..0c71173 --- /dev/null +++ b/m4/as-ac-expand.m4 @@ -0,0 +1,40 @@ +dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) +dnl +dnl example +dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) +dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local + +AC_DEFUN([AS_AC_EXPAND], +[ + EXP_VAR=[$1] + FROM_VAR=[$2] + + dnl first expand prefix and exec_prefix if necessary + prefix_save=$prefix + exec_prefix_save=$exec_prefix + + dnl if no prefix given, then use /usr/local, the default prefix + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + fi + dnl if no exec_prefix given, then use prefix + if test "x$exec_prefix" = "xNONE"; then + exec_prefix=$prefix + fi + + full_var="$FROM_VAR" + dnl loop until it doesn't change anymore + while true; do + new_full_var="`eval echo $full_var`" + if test "x$new_full_var"="x$full_var"; then break; fi + full_var=$new_full_var + done + + dnl clean up + full_var=$new_full_var + AC_SUBST([$1], "$full_var") + + dnl restore prefix and exec_prefix + prefix=$prefix_save + exec_prefix=$exec_prefix_save +]) diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4 new file mode 100644 index 0000000..605708a --- /dev/null +++ b/m4/as-compiler-flag.m4 @@ -0,0 +1,33 @@ +dnl as-compiler-flag.m4 0.1.0 + +dnl autostars m4 macro for detection of compiler flags + +dnl David Schleef + +dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $ + +dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given CFLAGS. +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, +dnl and ACTION-IF-NOT-ACCEPTED otherwise. + +AC_DEFUN([AS_COMPILER_FLAG], +[ + AC_MSG_CHECKING([to see if compiler understands $1]) + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + $2 + true + else + $3 + true + fi + AC_MSG_RESULT([$flag_ok]) +]) + diff --git a/m4/as-version.m4 b/m4/as-version.m4 new file mode 100644 index 0000000..defc887 --- /dev/null +++ b/m4/as-version.m4 @@ -0,0 +1,66 @@ +dnl as-version.m4 0.1.0 + +dnl autostars m4 macro for versioning + +dnl Thomas Vander Stichele + +dnl $Id: as-version.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $ + +dnl AS_VERSION(PACKAGE, PREFIX, MAJOR, MINOR, MICRO, NANO, +dnl ACTION-IF-NO-NANO, [ACTION-IF-NANO]) + +dnl example +dnl AS_VERSION(gstreamer, GST_VERSION, 0, 3, 2,) +dnl for a 0.3.2 release version + +dnl this macro +dnl - defines [$PREFIX]_MAJOR, MINOR and MICRO +dnl - if NANO is empty, then we're in release mode, else in cvs/dev mode +dnl - defines [$PREFIX], VERSION, and [$PREFIX]_RELEASE +dnl - executes the relevant action +dnl - AC_SUBST's PACKAGE, VERSION, [$PREFIX] and [$PREFIX]_RELEASE +dnl as well as the little ones +dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents +dnl maintainer mode from running ok +dnl +dnl don't forget to put #undef [$2] and [$2]_RELEASE in acconfig.h +dnl if you use acconfig.h + +AC_DEFUN([AS_VERSION], +[ + PACKAGE=[$1] + [$2]_MAJOR=[$3] + [$2]_MINOR=[$4] + [$2]_MICRO=[$5] + NANO=[$6] + [$2]_NANO=$NANO + if test "x$NANO" = "x" || test "x$NANO" = "x0"; + then + AC_MSG_NOTICE(configuring [$1] for release) + VERSION=[$3].[$4].[$5] + [$2]_RELEASE=1 + dnl execute action + ifelse([$7], , :, [$7]) + else + AC_MSG_NOTICE(configuring [$1] for development with nano $NANO) + VERSION=[$3].[$4].[$5].$NANO + [$2]_RELEASE=0.`date +%Y%m%d.%H%M%S` + dnl execute action + ifelse([$8], , :, [$8]) + fi + + [$2]=$VERSION + AC_DEFINE_UNQUOTED([$2], "$[$2]", [Define the version]) + AC_SUBST([$2]) + AC_DEFINE_UNQUOTED([$2]_RELEASE, "$[$2]_RELEASE", [Define the release version]) + AC_SUBST([$2]_RELEASE) + + AC_SUBST([$2]_MAJOR) + AC_SUBST([$2]_MINOR) + AC_SUBST([$2]_MICRO) + AC_SUBST([$2]_NANO) + AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define the package name]) + AC_SUBST(PACKAGE) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the version]) + AC_SUBST(VERSION) +]) diff --git a/m4/tp-compiler-flag.m4 b/m4/tp-compiler-flag.m4 new file mode 100644 index 0000000..06deaba --- /dev/null +++ b/m4/tp-compiler-flag.m4 @@ -0,0 +1,43 @@ +dnl A version of AS_COMPILER_FLAG that supports both C and C++. +dnl Based on: + +dnl as-compiler-flag.m4 0.1.0 +dnl autostars m4 macro for detection of compiler flags +dnl David Schleef +dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $ + +dnl TP_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given CFLAGS and CXXFLAGS. +dnl +dnl Runs ACTION-IF-ACCEPTED if the compiler for the currently selected +dnl AC_LANG can compile with the flags, and ACTION-IF-NOT-ACCEPTED otherwise. + +AC_DEFUN([TP_COMPILER_FLAG], +[ + AC_MSG_CHECKING([to see if compiler understands $1]) + + save_CFLAGS="$CFLAGS" + save_CXXFLAGS="$CXXFLAGS" + CFLAGS="$CFLAGS $1" + CXXFLAGS="$CXXFLAGS $1" + + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CFLAGS="$save_CFLAGS" + CXXFLAGS="$save_CXXFLAGS" + + if test "X$flag_ok" = Xyes ; then + $2 + true + else + $3 + true + fi + AC_MSG_RESULT([$flag_ok]) +]) + +dnl TP_ADD_COMPILER_FLAG(VARIABLE, CFLAGS) +dnl Append CFLAGS to VARIABLE if the compiler supports them. +AC_DEFUN([TP_ADD_COMPILER_FLAG], +[ + TP_COMPILER_FLAG([$2], [$1="[$]$1 $2"]) +]) diff --git a/m4/tp-compiler-warnings.m4 b/m4/tp-compiler-warnings.m4 new file mode 100644 index 0000000..ee4af31 --- /dev/null +++ b/m4/tp-compiler-warnings.m4 @@ -0,0 +1,49 @@ +dnl TP_COMPILER_WARNINGS(VARIABLE, WERROR_BY_DEFAULT, DESIRABLE, UNDESIRABLE) +dnl $1 (VARIABLE): the variable to put flags into +dnl $2 (WERROR_BY_DEFAULT): a command returning true if -Werror should be the +dnl default +dnl $3 (DESIRABLE): warning flags we want (e.g. all extra shadow) +dnl $4 (UNDESIRABLE): warning flags we don't want (e.g. +dnl missing-field-initializers unused-parameter) +AC_DEFUN([TP_COMPILER_WARNINGS], +[ + AC_REQUIRE([AC_ARG_ENABLE])dnl + AC_REQUIRE([AC_HELP_STRING])dnl + AC_REQUIRE([TP_COMPILER_FLAG])dnl + + tp_warnings="" + for tp_flag in $3; do + TP_COMPILER_FLAG([-W$tp_flag], [tp_warnings="$tp_warnings -W$tp_flag"]) + done + + tp_error_flags="-Werror" + TP_COMPILER_FLAG([-Werror], [tp_werror=yes], [tp_werror=no]) + + for tp_flag in $4; do + TP_COMPILER_FLAG([-Wno-$tp_flag], + [tp_warnings="$tp_warnings -Wno-$tp_flag"]) +dnl Yes, we do need to use both -Wno-foo and -Wno-error=foo. Simon says: +dnl some warnings we explicitly don't want, like unused-parameter, but +dnl they're in -Wall. when a distro using cdbs compiles us, we have: +dnl -Werror -Wno-unused-parameter -Wall +dnl ^ from us ^ from cdbs +dnl which turns -Wunused-parameter back on, in effect + TP_COMPILER_FLAG([-Wno-error=$tp_flag], + [tp_error_flags="$tp_error_flags -Wno-error=$tp_flag"], [tp_werror=no]) + done + + AC_ARG_ENABLE([Werror], + AC_HELP_STRING([--disable-Werror], + [compile without -Werror (normally enabled in development builds)]), + tp_werror=$enableval, :) + + if test "x$tp_werror" = xyes && $2; then +dnl We put -Wno-error=foo before -Wno-foo because clang interprets -Wall +dnl -Werror -Wno-foo -Wno-error=foo as “make foo a non-fatal warning”, but does +dnl what we want if you reverse them. + $1="$tp_error_flags $tp_warnings" + else + $1="$tp_warnings" + fi + +]) diff --git a/m4/tp-linker-flag.m4 b/m4/tp-linker-flag.m4 new file mode 100644 index 0000000..8fd3506 --- /dev/null +++ b/m4/tp-linker-flag.m4 @@ -0,0 +1,44 @@ +dnl A version of AS_COMPILER_FLAG that supports linker flags +dnl Based on: + +dnl as-compiler-flag.m4 0.1.0 +dnl autostars m4 macro for detection of compiler flags +dnl David Schleef +dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $ + +dnl TP_LINKER_FLAG(LDFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given LDFLAGS. +dnl +dnl Runs ACTION-IF-ACCEPTED if the compiler/linker for the currently selected +dnl AC_LANG can compile with the flags, and ACTION-IF-NOT-ACCEPTED otherwise. +dnl +dnl Note that LDFLAGS are passed to the linker via the compiler, so you +dnl should check for -Wl,--no-add-needed rather than --no-add-needed. + +AC_DEFUN([TP_LINKER_FLAG], +[ + AC_MSG_CHECKING([to see if compiler/linker understand $1]) + + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $1" + + AC_COMPILE_IFELSE(AC_LANG_SOURCE([]), [flag_ok=yes], [flag_ok=no]) + + LDFLAGS="$save_LDFLAGS" + + if test "X$flag_ok" = Xyes ; then + $2 + true + else + $3 + true + fi + AC_MSG_RESULT([$flag_ok]) +]) + +dnl TP_ADD_LINKER_FLAG(VARIABLE, LDFLAGS) +dnl Append LDFLAGS to VARIABLE if the linker supports them. +AC_DEFUN([TP_ADD_LINKER_FLAG], +[ + TP_LINKER_FLAG([$2], [$1="[$]$1 $2"]) +]) diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..d1196ce --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,50 @@ +# correctly clean the generated source files +CLEANFILES = $(BUILT_SOURCES) $(man_MANS) + +libexec_PROGRAMS=telepathy-matrix + +libmatrix_convenience_la_SOURCES = \ + matrix-connection-manager.c \ + matrix-connection-manager.h \ + matrix-protocol.c \ + matrix-protocol.h \ + matrix-debug.c \ + matrix-debug.h \ + $(NULL) + +nodist_libmatrix_convenience_la_SOURCES = \ + $(BUILT_SOURCES) + +telepathy_matrix_SOURCES = \ + matrix.c + +telepathy_matrix_LDADD = \ + libmatrix-convenience.la \ + $(ALL_LIBS) + +noinst_LTLIBRARIES = libmatrix-convenience.la + +AM_CFLAGS = \ + -I$(top_srcdir) \ + -I$(top_builddir) \ + $(ERROR_CFLAGS) \ + @DBUS_CFLAGS@ \ + @GLIB_CFLAGS@ \ + @TELEPATHY_CFLAGS@ \ + -std=c99 + +AM_LDFLAGS = \ + $(ERROR_LDFLAGS) \ + $(NULL) + +ALL_LIBS = \ + @DBUS_LIBS@ \ + @GLIB_LIBS@ \ + @TELEPATHY_LIBS@ + +man_MANS = telepathy-matrix.8 + +EXTRA_DIST = telepathy-matrix.8.in + +%.8: %.8.in Makefile + $(AM_V_GEN)sed -e 's,[@]libexecdir[@],@libexecdir@,' < $< > $@ diff --git a/src/matrix-connection-manager.c b/src/matrix-connection-manager.c new file mode 100644 index 0000000..fe8d757 --- /dev/null +++ b/src/matrix-connection-manager.c @@ -0,0 +1,62 @@ +/* + * This file is part of telepathy-matrix. + * + * telepathy-matrix 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 3 of the + * License, or (at your option) any later version. + * + * telepathy-matrix 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 telepathy-matrix. If not, see + * . + */ + +#include "matrix-connection-manager.h" +#include "matrix-protocol.h" + +G_DEFINE_TYPE(MatrixConnectionManager, matrix_connection_manager, TP_TYPE_BASE_CONNECTION_MANAGER); + +static void +matrix_connection_manager_finalize(GObject *gobject) +{ + g_signal_handlers_destroy(gobject); + G_OBJECT_CLASS(matrix_connection_manager_parent_class)->finalize(gobject); +} + +static void +matrix_connection_manager_constructed(GObject *gobject) +{ + TpBaseConnectionManager *base = (TpBaseConnectionManager *)gobject; + TpBaseProtocol *p; + void (*constructed)(GObject *) = ((GObjectClass *)matrix_connection_manager_parent_class)->constructed; + + if (constructed != NULL) { + constructed(gobject); + } + + p = matrix_protocol_new(); + tp_base_connection_manager_add_protocol(base, p); + g_object_unref(p); +} + +static void +matrix_connection_manager_class_init(MatrixConnectionManagerClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + TpBaseConnectionManagerClass *parent_class = TP_BASE_CONNECTION_MANAGER_CLASS(klass); + + parent_class->cm_dbus_name = "matrix"; + + gobject_class->finalize = matrix_connection_manager_finalize; + gobject_class->constructed = matrix_connection_manager_constructed; +} + +static void +matrix_connection_manager_init(MatrixConnectionManager *connection_manager) +{ +} diff --git a/src/matrix-connection-manager.h b/src/matrix-connection-manager.h new file mode 100644 index 0000000..3681d20 --- /dev/null +++ b/src/matrix-connection-manager.h @@ -0,0 +1,54 @@ +/* + * This file is part of telepathy-matrix. + * + * telepathy-matrix 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 3 of the + * License, or (at your option) any later version. + * + * telepathy-matrix 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 telepathy-matrix. If not, see + * . + */ + +#ifndef __MATRIX_CONNECTION_MANAGER_H__ +#define __MATRIX_CONNECTION_MANAGER_H__ + +#include +#include + +G_BEGIN_DECLS + +/* TYPE MACROS */ + +#define MATRIX_TYPE_CONNECTION_MANAGER (matrix_connection_manager_get_type()) +#define MATRIX_CONNECTION_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), MATRIX_TYPE_CONNECTION_MANAGER, MatrixConnectionManager)) +#define MATRIX_CONNECTION_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MATRIX_TYPE_CONNECTION_MANAGER, MatrixConnectionManagerClass)) +#define MATRIX_IS_CONNECTION_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), MATRIX_TYPE_CONNECTION_MANAGER)) +#define MATRIX_IS_CONNECTION_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), MATRIX_TYPE_CONNECTION_MANAGER)) +#define MATRIX_CONNECTION_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MATRIX_TYPE_CONNECTION_MANAGER, MatrixConnectionManagerClass)) + +typedef struct _MatrixConnectionManager MatrixConnectionManager; +typedef struct _MatrixConnectionManagerClass MatrixConnectionManagerClass; + +struct _MatrixConnectionManagerClass { + TpBaseConnectionManagerClass parent_class; +}; + +struct _MatrixConnectionManager { + /* Parent instance structure */ + TpBaseConnection parent; + + /* Instance members */ +}; + +GType matrix_connection_manager_get_type(void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __MATRIX_CONNECTION_MANAGER_H__ */ diff --git a/src/matrix-debug.c b/src/matrix-debug.c new file mode 100644 index 0000000..546f6a6 --- /dev/null +++ b/src/matrix-debug.c @@ -0,0 +1,121 @@ +/* + * This file is part of telepathy-matrix. + * + * telepathy-matrix 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 3 of the + * License, or (at your option) any later version. + * + * telepathy-matrix 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 telepathy-matrix. If not, see + * . + */ + +#include "config.h" +#include "matrix-debug.h" + +#include +#include + +static MatrixDebugFlags _flags = 0; + +static GDebugKey _keys[] = { + {"connection", MATRIX_DEBUG_CONNECTION}, + {"dns", MATRIX_DEBUG_DNS}, + {"im", MATRIX_DEBUG_IM}, + {"muc", MATRIX_DEBUG_MUC}, + {"network", MATRIX_DEBUG_NETWORK}, + {"parser", MATRIX_DEBUG_PARSER}, + {"text", MATRIX_DEBUG_TEXT}, + {"tls", MATRIX_DEBUG_TLS}, + {NULL, 0} +}; + +void +matrix_debug_init (void) { + const gchar *flags_string = g_getenv("MATRIX_DEBUG"); + guint nkeys; + + for (nkeys = 0; _keys[nkeys].value; nkeys++) { + /* do nothing, just count nkeys */ + } + + if (flags_string) { + tp_debug_set_flags(flags_string); + _flags |= g_parse_debug_string(flags_string, _keys, nkeys); + } + + if (g_getenv("MATRIX_PERSIST") != NULL) + tp_debug_set_persistent(TRUE); +} + +GHashTable *flag_to_domains = NULL; + +static const gchar * +debug_flag_to_domain (MatrixDebugFlags flag) +{ + if (G_UNLIKELY (flag_to_domains == NULL)) { + guint i; + + flag_to_domains = g_hash_table_new_full (NULL, NULL, NULL, g_free); + + for (i = 0; _keys[i].value; i++) { + GDebugKey key = _keys[i]; + gchar *val; + + val = g_strdup_printf ("%s/%s", "matrix", key.key); + g_hash_table_insert (flag_to_domains, + GUINT_TO_POINTER (key.value), val); + } + } + + return g_hash_table_lookup (flag_to_domains, GUINT_TO_POINTER (flag)); +} + +void +matrix_debug_free (void) +{ + if (flag_to_domains == NULL) + return; + + g_hash_table_destroy (flag_to_domains); + flag_to_domains = NULL; +} + +static void +log_to_debug_sender (MatrixDebugFlags flag, + const gchar *message) +{ + TpDebugSender *dbg; + GTimeVal now; + + dbg = tp_debug_sender_dup (); + + g_get_current_time (&now); + + tp_debug_sender_add_message (dbg, &now, debug_flag_to_domain (flag), + G_LOG_LEVEL_DEBUG, message); + + g_object_unref (dbg); +} + +void matrix_debug(MatrixDebugFlags flag, const gchar *format, ...) { + gchar *message; + va_list args; + + va_start (args, format); + message = g_strdup_vprintf (format, args); + va_end (args); + + log_to_debug_sender (flag, message); + + if (_flags & flag) + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s", message); + + g_free (message); +} diff --git a/src/matrix-debug.h b/src/matrix-debug.h new file mode 100644 index 0000000..c94abab --- /dev/null +++ b/src/matrix-debug.h @@ -0,0 +1,49 @@ +/* + * This file is part of telepathy-matrix. + * + * telepathy-matrix 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 3 of the + * License, or (at your option) any later version. + * + * telepathy-matrix 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 telepathy-matrix. If not, see + * . + */ + +#ifndef __MATRIX_DEBUG_H_ +#define __MATRIX_DEBUG_H_ + +#include + +typedef enum { + MATRIX_DEBUG_CONNECTION = (1 << 0), + MATRIX_DEBUG_DNS = (1 << 1), + MATRIX_DEBUG_IM = (1 << 2), + MATRIX_DEBUG_MUC = (1 << 3), + MATRIX_DEBUG_NETWORK = (1 << 4), + MATRIX_DEBUG_PARSER = (1 << 5), + MATRIX_DEBUG_TEXT = (1 << 6), + MATRIX_DEBUG_ROOMLIST = (1 << 7), + MATRIX_DEBUG_TLS = (1 << 8), +} MatrixDebugFlags; + +void matrix_debug_init (void); +void matrix_debug(MatrixDebugFlags flag, const gchar *format, ...) G_GNUC_PRINTF(2, 3); + +void matrix_debug_free (void); + +#endif + +#ifdef MATRIX_DEBUG_FLAG + +#undef MATRIX_DEBUG +#define MATRIX_DEBUG(format, ...) \ + matrix_debug(MATRIX_DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__) + +#endif diff --git a/src/matrix-protocol.c b/src/matrix-protocol.c new file mode 100644 index 0000000..533c5f1 --- /dev/null +++ b/src/matrix-protocol.c @@ -0,0 +1,51 @@ +/* + * This file is part of telepathy-matrix. + * + * telepathy-matrix 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 3 of the + * License, or (at your option) any later version. + * + * telepathy-matrix 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 telepathy-matrix. If not, see + * . + */ + +#include "matrix-protocol.h" + +#define PROTOCOL_NAME "matrix" + +G_DEFINE_TYPE(MatrixProtocol, matrix_protocol, TP_TYPE_BASE_PROTOCOL); + +static void +matrix_protocol_finalize(GObject *gobject) +{ + g_signal_handlers_destroy(gobject); + G_OBJECT_CLASS(matrix_protocol_parent_class)->finalize(gobject); +} + +static void +matrix_protocol_class_init(MatrixProtocolClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->finalize = matrix_protocol_finalize; +} + +static void +matrix_protocol_init(MatrixProtocol *protocol) +{ +} + +TpBaseProtocol * +matrix_protocol_new(void) +{ + return g_object_new(MATRIX_TYPE_PROTOCOL, + "name", PROTOCOL_NAME, + NULL); +} diff --git a/src/matrix-protocol.h b/src/matrix-protocol.h new file mode 100644 index 0000000..f75ac6a --- /dev/null +++ b/src/matrix-protocol.h @@ -0,0 +1,53 @@ +/* + * This file is part of telepathy-matrix. + * + * telepathy-matrix 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 3 of the + * License, or (at your option) any later version. + * + * telepathy-matrix 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 telepathy-matrix. If not, see + * . + */ + +#ifndef __MATRIX_PROTOCOL_H__ +#define __MATRIX_PROTOCOL_H__ + +#include + +G_BEGIN_DECLS + +#define MATRIX_TYPE_PROTOCOL (matrix_protocol_get_type()) +#define MATRIX_PROTOCOL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), MATRIX_TYPE_PROTOCOL, MatrixProtocol)) +#define MATRIX_PROTOCOL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MATRIX_TYPE_PROTOCOL, MatrixProtocolClass)) +#define MATRIX_IS_PROTOCOL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), MATRIX_TYPE_PROTOCOL)) +#define MATRIX_IS_PROTOCOL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), MATRIX_TYPE_PROTOCOL)) +#define MATRIX_PROTOCOL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MATRIX_TYPE_PROTOCOL, MatrixProtocolClass)) + +typedef struct _MatrixProtocol MatrixProtocol; +typedef struct _MatrixProtocolClass MatrixProtocolClass; + +struct _MatrixProtocol { + /* Parent instance structure */ + TpBaseProtocol parent_instance; + + /* Instance members */ +}; + +struct _MatrixProtocolClass { + TpBaseProtocolClass parent_class; +}; + +GType matrix_protocol_get_type(void) G_GNUC_CONST; + +TpBaseProtocol *matrix_protocol_new(void); + +G_END_DECLS + +#endif /* __MATRIX_PROTOCOL_H__ */ diff --git a/src/matrix.c b/src/matrix.c new file mode 100644 index 0000000..dae466c --- /dev/null +++ b/src/matrix.c @@ -0,0 +1,54 @@ +/* + * This file is part of telepathy-matrix. + * + * telepathy-matrix 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 3 of the + * License, or (at your option) any later version. + * + * telepathy-matrix 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 telepathy-matrix. If not, see + * . + */ + +#include + +#include + +#include "matrix-connection-manager.h" +#include "matrix-debug.h" + +static +TpBaseConnectionManager *_construct_cm(void) +{ + TpBaseConnectionManager *base_cm = TP_BASE_CONNECTION_MANAGER( + g_object_new(MATRIX_TYPE_CONNECTION_MANAGER, NULL)); + + return base_cm; +} + +int main(int argc, char **argv) { + TpDebugSender *debug_sender; + int result; + + g_type_init (); + tp_debug_divert_messages (g_getenv ("MATRIX_LOGFILE")); + + matrix_debug_init(); + + debug_sender = tp_debug_sender_dup (); + + result = tp_run_connection_manager( + "telepathy-matrix", VERSION, + _construct_cm, + argc, argv); + + g_object_unref (debug_sender); + + return result; +} diff --git a/src/telepathy-matrix.8.in b/src/telepathy-matrix.8.in new file mode 100644 index 0000000..ab4dafc --- /dev/null +++ b/src/telepathy-matrix.8.in @@ -0,0 +1,35 @@ +.TH TELEPATHY-MATRIX "8" "December 2015" "Telepathy" "D-Bus services" +\" This man page was written by Gergely Polonkai for the Telepathy +\" Matrix Project, but may be used by others. +\" Copyright © 2015 Gergely Polonkai +\" It may be distributed under the same terms as telepathy-matrix itself. +.SH NAME +telepathy-matrix \- Telepathy connection manager for Matrix.org +.SH SYNOPSIS +\fB@libexecdir@/telepathy\-matrix\fR +.SH DESCRIPTION +Telepathy Matrix implements the Telepathy D-Bus specification for +Matrix.org, allowing Telepathy clients like +.BR empathy (1) +to connect to Matrix.org home servers. +.PP +It is a D-Bus service which runs on the session bus, and should usually be +started automatically by D-Bus activation. However, it might be useful to +start it manually for debugging. +.SH OPTIONS +There are no command-line options. +.SH ENVIRONMENT +.TP +\fBMATRIX_LOGFILE\fR=\fIfilename\fR +If set, debug output will go to the given file rather than to stderr. +If \fB+\fR is prepended to the \fIfilename\fR (e.g. +\fBMATRIX_LOGFILE=+matrix.log\fR), debug output will be appended +to the file; otherwise, any existing file will be replaced. +.TP +.TP +\fBMATRIX_DEBUG\fR=\fItype\fR +May be set to "all" for full debug output, or various undocumented options +(which may change from release to release) to filter the output. +.SH SEE ALSO +.IR http://telepathy.freedesktop.org/ , +.BR empathy (1) diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..7b4106d --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,14 @@ +EXTRA_DIST = \ + c-constants-generator.xsl \ + c-interfaces-generator.xsl \ + doc-generator.xsl \ + glib-ginterface-gen.py \ + identity.xsl \ + libglibcodegen.py \ + libtpcodegen.py \ + make-release-mail.py + +CLEANFILES = libglibcodegen.pyc libglibcodegen.pyo + +glib-ginterface-gen.py: libglibcodegen.py libtpcodegen.py + touch $@ diff --git a/tools/telepathy.am b/tools/telepathy.am new file mode 100644 index 0000000..2b6c430 --- /dev/null +++ b/tools/telepathy.am @@ -0,0 +1,80 @@ +## Useful top-level Makefile.am snippets for Telepathy projects. + +dist-hook: + chmod u+w ${distdir}/ChangeLog + if test -d ${top_srcdir}/.git; then \ + ( cd ${top_srcdir} && git log --date=iso $(CHANGELOG_RANGE) ) > ${distdir}/ChangeLog; \ + fi + +distcheck-hook: + @test "z$(CHECK_FOR_UNRELEASED)" = z || \ + case @VERSION@ in \ + *.*.*.*|*+) ;; \ + *) \ + if grep -r UNRELEASED $(CHECK_FOR_UNRELEASED); \ + then \ + echo "^^^ This is meant to be a release, but some files say UNRELEASED" >&2; \ + exit 2; \ + fi \ + ;; \ + esac + +_is-release-check: + @case @VERSION@ in \ + (*.*.*.*|*+) \ + echo "Hey! @VERSION@ is not a release!" >&2; \ + exit 2; \ + ;; \ + esac + @cd ${top_srcdir} && \ + if ! git diff --no-ext-diff --quiet --exit-code; then \ + echo "Hey! Your tree is dirty! No release for you." >&2; \ + exit 2; \ + fi + @cd ${top_srcdir} && \ + if ! git diff --cached --no-ext-diff --quiet --exit-code; then \ + echo "Hey! You have changes staged! No release for you." >&2; \ + exit 2; \ + fi + +%.tar.gz.asc: %.tar.gz + $(AM_V_GEN)gpg --detach-sign --armor $@ + +@PACKAGE@-@VERSION@.tar.gz: + $(MAKE) _is-release-check + $(MAKE) check + $(MAKE) distcheck + +maintainer-prepare-release: + $(MAKE) _is-release-check + $(MAKE) all + $(MAKE) distcheck + $(MAKE) release-mail + git tag -s @PACKAGE@-@VERSION@ -m @PACKAGE@' '@VERSION@ + gpg --detach-sign --armor @PACKAGE@-@VERSION@.tar.gz + +release-mail: NEWS + $(AM_V_GEN)(python $(top_srcdir)/tools/make-release-mail.py \ + @PACKAGE@ @VERSION@ $(top_srcdir)/NEWS > $@.tmp && \ + mv $@.tmp $@) + +maintainer-upload-release: _maintainer-upload-release + +_maintainer-upload-release-check: _is-release-check + test -f @PACKAGE@-@VERSION@.tar.gz + test -f @PACKAGE@-@VERSION@.tar.gz.asc + gpg --verify @PACKAGE@-@VERSION@.tar.gz.asc + +_maintainer-upload-release: _maintainer-upload-release-check + rsync -vzP @PACKAGE@-@VERSION@.tar.gz telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz + rsync -vzP @PACKAGE@-@VERSION@.tar.gz.asc telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.gz.asc + +maintainer-make-release: + $(MAKE) maintainer-prepare-release + $(MAKE) maintainer-upload-release + @echo "Now:" + @echo " • bump the nano-version;" + @echo " • push the branch and tags upstream; and" + @echo " • send release-mail to ." + +## vim:set ft=automake: