From bf6d596e40e5b9426a68dcd22aa62a697457c4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 13 Feb 2016 10:08:42 +0100 Subject: ctcp: Don't bling the non-bling When stripping color codes, we currently remove any sequence of digits following ^C. As color codes use at most two digits, this means that we also remove any numbers at the start of the colored text - make sure we stop doing that and only remove digits that are actually part of a color code. https://bugs.freedesktop.org/show_bug.cgi?id=94189 --- src/idle-ctcp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/idle-ctcp.c b/src/idle-ctcp.c index f282360..f28bf4b 100644 --- a/src/idle-ctcp.c +++ b/src/idle-ctcp.c @@ -98,13 +98,18 @@ gchar *idle_ctcp_kill_blingbling(const gchar *msg) { case '\x03': /* ^C */ iter++; - while (isdigit(*iter)) + /* Color codes are 1-2 digits */ + if (isdigit(*iter)) + iter++; + if (isdigit(*iter)) iter++; if (*iter == ',') { iter++; - while (isdigit(*iter)) + if (isdigit(*iter)) + iter++; + if (isdigit(*iter)) iter++; } break; -- cgit v1.2.1 From 5a2510ddea8f165f0808a8841e1dca311c003e20 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Sat, 4 Nov 2017 23:03:26 -0700 Subject: Update self-signed certificate to 2048 bytes with SHA-256 signature Valid for 10 years --- tests/twisted/tools/idletest.cert | 26 ++++++++++++++++++-------- tests/twisted/tools/idletest.key | 32 +++++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/tests/twisted/tools/idletest.cert b/tests/twisted/tools/idletest.cert index 655abc2..7ea6bcc 100644 --- a/tests/twisted/tools/idletest.cert +++ b/tests/twisted/tools/idletest.cert @@ -1,10 +1,20 @@ -----BEGIN CERTIFICATE----- -MIIBTzCB+gIBATANBgkqhkiG9w0BAQQFADAzMRIwEAYDVQQKEwl0ZWxlcGF0aHkx -HTAbBgNVBAsTFHRlbGVwYXRoeSBkZXZlbG9wZXJzMB4XDTA5MDExNDE3N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G +CWCGSAGG+EIBAQQEAwIGQDAeBglghkgBhvhCAQ0EERYPeGNhIGNlcnRpZmljYXRl +MA0GCSqGSIb3DQEBCwUAA4IBAQBJCT/EPWqv/wUDn7jK4nRXXXwtIL7eYYTAvcJh +gxtrkkNB1LAp6mnb1WOw+Wbdpf2IgTqfAvpzCRL+kCM80Pqh365JlA5JflzhWxsJ +xtJQfNfiZhgXKN1rm5lT+U/WgGR6A1serbxUiRN2O6wB8nxtoc7sBJh18pcrwpam +vOGAolbePV8HPfyBRkCnSw1X6BdifEtxlRCfVWELSI6xQHX8OPTU+uGcvte5uAEi +7CRRJHlUoojyLOxlJ6IeXh7MjrDIi6tHDqVR9MlRRN3oXhvsN/TtsZUuuC7s280W +oapk/x7WNDSQsdsi0bmTLrJoZgHzaPRJPCwBFzbj/T1kCC0B -----END CERTIFICATE----- diff --git a/tests/twisted/tools/idletest.key b/tests/twisted/tools/idletest.key index 3a80dab..d579266 100644 --- a/tests/twisted/tools/idletest.key +++ b/tests/twisted/tools/idletest.key @@ -1,9 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAL3P+mLMQx4v5s7eCIlUYcas4csTsB8OisCvCYDS7wKC7Tr4n5Jb -40meSPwC3huKjFESB7rJ4Pr5wcIL2TNeuZcCAwEAAQJBAJLaJc3qWsMwLFJAVjpp -nnwnpUmIoeplRdRtl9yjVWeKrvD2gSh2Qz693dgJbDUGURJecJ+LSS4YMOS+8FLp -KgECIQDhgvqh9KahKphn2/vvcCx3DKBZ7wh9lYIaaAay6IuAhwIhANd5cF48u0ID -39kZCwfhpAKQDxvpqmbnRzB0hISjEpJxAiARfZIo24vM9jvJ2mMI6B9awGzzbLmw -29aya50RZT3kowIhALrT2NJc5iB/K4AZbq8Ovh5auj8Bg3Zl4hvpa11154yBAiAO -F+44Mb+YQi+r526cDv983vCuoU5EM0PbPvJxaWmwtQ== +MIIEpAIBAAKCAQEAvfB9mhPOYmpDKPDS1OgB+Wl2ZAxM2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bU0fJ0ntj+Je8/+X09bNDS5syXPMWKZCbWxZVfmNrQ7tHQq2sWtvoV+oub +AgJ/4wStXH3EZa3xQNkcWpYmbTn1gf658+KRnxlx7FTYlOPqeU30d2FsaLWi2KJ2 +7kjx1WZOC4zd/wGyD0+tXjp7AoGAcNM9gwb9hkqfS0s25mhWtY9u0OzOd+rsAt5X +CzfaRQwu0J3+8NWM01WrxRE9NDtOBudgtP/Z1crKtbnve6bJwkT0a6ZJkae0yO7x +G9+JLXIPPAC7ftfaq5J0Fyshx/OatL1z6+S1fvURm/nmvrRD8PVz3PeDJcfh1uku +1JjRWnUCgYAFnAsOddzyRMe52WbeoDbl/AFJZMBbLDb2fI9yGNzy2Y79V0Bvxi3k +iSp6vHXA2tiVysyeEgVWYOdPmblQ6GRivAW75sgyuma1A0GJqkmd1EPXwbFNod8K +Ax0XXK2/olLTWtSOs8Cxmopb+V1rpyuTwlhyHc9J4HGEEBeazlYg3A== -----END RSA PRIVATE KEY----- -- cgit v1.2.1 From 0ce3a8fa2bd3f4e72358bb53ecd0acf8fe448483 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Sat, 4 Nov 2017 23:32:32 -0700 Subject: Avoid errors from Python caused by the deliberatly invalid Unicode Because stream.nick is Unicode when sendMessage combines the command, nick, and invalid utf8 python 2.7 ends up converting everything to Unicode. Since this test deliberately includes invalid Unicode, Python notices and throws an exception. In Python 3, network traffic is usually encoded as bytes. So I thought coercing the nick to bytes would be appropriate, and as bytes can contain anything including invalid Unicode, Python doesn't throw an exception. --- tests/twisted/messages/invalid-utf8.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/twisted/messages/invalid-utf8.py b/tests/twisted/messages/invalid-utf8.py index a48c2f4..725e3bd 100644 --- a/tests/twisted/messages/invalid-utf8.py +++ b/tests/twisted/messages/invalid-utf8.py @@ -33,7 +33,7 @@ def test_with_message(q, stream, parts): # Idle's default character set is UTF-8. We send it a message which is # basically UTF-8, except that one of its code points is invalid. - stream.sendMessage('PRIVMSG', stream.nick, ':%s' % invalid_utf8, + stream.sendMessage('PRIVMSG', bytes(stream.nick), ':%s' % invalid_utf8, prefix='remoteuser') # Idle should signal that *something* was received. If it hasn't validated -- cgit v1.2.1 From acf5fcf4d830ae0b5953d8ded8eba4c17726c6f3 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Mon, 6 Nov 2017 21:46:00 -0800 Subject: Returning FALSE from the timer function causes the timeout to be destroyed I asked one of the polari devs and was told that yes it is ok to set the timer id to zero in the timer function. With this patch make check works without changing any of the expected test results and without any coredumps --- src/idle-connection.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/idle-connection.c b/src/idle-connection.c index 6ab5fea..71c020f 100644 --- a/src/idle-connection.c +++ b/src/idle-connection.c @@ -600,6 +600,7 @@ _force_disconnect (gpointer data) IDLE_DEBUG("gave up waiting, forcibly disconnecting"); idle_server_connection_force_disconnect(priv->conn); + priv->force_disconnect_id = 0; return FALSE; } -- cgit v1.2.1 From 5e5b677173ef64055b4a7073cb5a15066fc03f70 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 14 Feb 2014 12:12:54 +0100 Subject: idle-connection: make sure to always reset force_disconnect_id Recent GLib raises a critical when trying to remove an invalid source. (cherry picked from commit 12211654baa75db13a05b5c2b3293d1378fcf7a2) --- src/idle-connection.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/idle-connection.c b/src/idle-connection.c index 71c020f..8614d52 100644 --- a/src/idle-connection.c +++ b/src/idle-connection.c @@ -585,6 +585,7 @@ static gboolean _finish_shutdown_idle_func(gpointer data) { IdleConnectionPrivate *priv = self->priv; if (priv->force_disconnect_id != 0) { g_source_remove(priv->force_disconnect_id); + priv->force_disconnect_id = 0; } tp_base_connection_finish_shutdown(conn); -- cgit v1.2.1 From 3f04a0d60fdc653bffd6919cb374a8d496771a8e Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Wed, 23 Sep 2020 17:25:10 -0500 Subject: Fix build with python3 Hello from 2020! Fixes taken from Bastien's Fedora patches. Thanks Bastien! --- tools/glib-ginterface-gen.py | 13 ++++--------- tools/libglibcodegen.py | 4 ++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py index 8fea5df..995d874 100644 --- a/tools/glib-ginterface-gen.py +++ b/tools/glib-ginterface-gen.py @@ -22,6 +22,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import functools import sys import os.path import xml.dom.minidom @@ -85,18 +86,12 @@ class Generator(object): self.allow_havoc = allow_havoc def h(self, s): - if isinstance(s, unicode): - s = s.encode('utf-8') self.__header.append(s) def b(self, s): - if isinstance(s, unicode): - s = s.encode('utf-8') self.__body.append(s) def d(self, s): - if isinstance(s, unicode): - s = s.encode('utf-8') self.__docs.append(s) def do_node(self, node): @@ -733,7 +728,7 @@ class Generator(object): def __call__(self): nodes = self.dom.getElementsByTagName('node') - nodes.sort(cmp_by_name) + nodes.sort(key=functools.cmp_to_key(cmp_by_name)) self.h('#include ') self.h('#include ') @@ -768,7 +763,7 @@ class Generator(object): file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs)) def cmdline_error(): - print """\ + print ("""\ usage: gen-ginterface [OPTIONS] xmlfile Prefix_ options: @@ -788,7 +783,7 @@ options: void symbol (DBusGMethodInvocation *context) and return some sort of "not implemented" error via dbus_g_method_return_error (context, ...) -""" +""") sys.exit(1) diff --git a/tools/libglibcodegen.py b/tools/libglibcodegen.py index 6a9d214..2c9f164 100644 --- a/tools/libglibcodegen.py +++ b/tools/libglibcodegen.py @@ -154,7 +154,7 @@ def type_to_gtype(s): return ("GHashTable *", "DBUS_TYPE_G_STRING_STRING_HASHTABLE", "BOXED", False) elif s[:2] == 'a{': #some arbitrary hash tables if s[2] not in ('y', 'b', 'n', 'q', 'i', 'u', 's', 'o', 'g'): - raise Exception, "can't index a hashtable off non-basic type " + s + raise Exception("can't index a hashtable off non-basic type " + s) first = type_to_gtype(s[2]) second = type_to_gtype(s[3:-1]) return ("GHashTable *", "(dbus_g_type_get_map (\"GHashTable\", " + first[1] + ", " + second[1] + "))", "BOXED", False) @@ -169,4 +169,4 @@ def type_to_gtype(s): return ("GValueArray *", gtype, "BOXED", True) # we just don't know .. - raise Exception, "don't know the GType for " + s + raise(Exception, "don't know the GType for " + s) -- cgit v1.2.1 From 6967ca8e1f8d8f7948a430fea0bf159e126042be Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Thu, 24 Sep 2020 07:03:10 -0500 Subject: Properly handle long IRC messages IRC messages are delimited by CRLF. When the string passed to idle_parser_receive() doesn't end in \r or \n, the remaining parts get stashed away to be used to form a message on the next call to idle_parser_receive(). But telepathy-idle improperly assumes that the next call to idle_parser_receive() will definitely contain \r or \n, i.e. it assumes that an IRC message cannot be split between three calls to idle_parser_receive(). That assumption is wrong. Fixes polari#147 --- src/idle-parser.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/idle-parser.c b/src/idle-parser.c index 159e6cc..71ca8b1 100644 --- a/src/idle-parser.c +++ b/src/idle-parser.c @@ -151,6 +151,7 @@ struct _IdleParserPrivate { /* continuation line buffer */ gchar split_buf[IRC_MSG_MAXLEN + 3]; + guint split_buf_used; /* message handlers */ GSList *handlers[IDLE_PARSER_LAST_MESSAGE_CODE]; @@ -226,6 +227,13 @@ strnlen(const char *msg, size_t maxlen) } #endif +static void clear_split_buf(IdleParser *parser) { + IdleParserPrivate *priv = IDLE_PARSER_GET_PRIVATE(parser); + + memset(priv->split_buf, '\0', IRC_MSG_MAXLEN + 3); + priv->split_buf_used = 0; +} + void idle_parser_receive(IdleParser *parser, const gchar *msg) { IdleParserPrivate *priv = IDLE_PARSER_GET_PRIVATE(parser); guint i; @@ -245,7 +253,7 @@ void idle_parser_receive(IdleParser *parser, const gchar *msg) { if ((lasti == 0) && (priv->split_buf[0] != '\0')) { g_strlcpy(g_stpcpy(concat_buf, priv->split_buf), msg, i + 1); tmp = concat_buf; - memset(priv->split_buf, '\0', IRC_MSG_MAXLEN + 3); + clear_split_buf(parser); } else { tmp = g_strndup(msg + lasti, i - lasti); } @@ -264,10 +272,18 @@ void idle_parser_receive(IdleParser *parser, const gchar *msg) { } } - if (!line_ends) - g_strlcpy(priv->split_buf, msg + lasti, (IRC_MSG_MAXLEN + 3) - lasti); - else - memset(priv->split_buf, '\0', IRC_MSG_MAXLEN + 3); + if (!line_ends) { + len = strlen(msg + lasti); + if (len > (IRC_MSG_MAXLEN + 3) - priv->split_buf_used - 1) { + IDLE_DEBUG("Discarding content that exceeds maximum message length: \"%s\"", msg + lasti); + clear_split_buf(parser); + } else { + g_strlcpy(priv->split_buf + priv->split_buf_used, msg + lasti, (IRC_MSG_MAXLEN + 3) - priv->split_buf_used); + priv->split_buf_used += len; + } + } else { + clear_split_buf(parser); + } } void idle_parser_add_handler(IdleParser *parser, IdleParserMessageCode code, IdleParserMessageHandler handler, gpointer user_data) { -- cgit v1.2.1 From c9b6a16206dd25c37ea3fc43f2b8870bfe410e52 Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Sun, 1 Nov 2020 01:33:47 +0300 Subject: tools/make-release-mail: Update from telepathy-glib (fix for python 3) --- tools/make-release-mail.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tools/make-release-mail.py b/tools/make-release-mail.py index 5c42b47..3343838 100644 --- a/tools/make-release-mail.py +++ b/tools/make-release-mail.py @@ -6,6 +6,15 @@ # to . I hope that you enjoy your stay. import sys +import re + +def looks_like_a_header(line, package, version=None): + if version is None: + pattern = "^%s .* \(.*\)$" % package + else: + pattern = "^%s %s \(.*\)$" % (package, version) + + return re.match(pattern, line) is not None def extract_description(package, version, news_path): release_name = [] @@ -15,19 +24,19 @@ def extract_description(package, version, news_path): lines = (line for line in f.readlines()) for line in lines: # Find the 'telepathy-foo 0.1.2' header - if line.startswith("%s %s" % (package, version)): + if looks_like_a_header(line, package, version): break # Skip the ====== line, and the first blank line - lines.next() - lines.next() + next(lines) + next(lines) got_release_name = False for line in lines: line = line.rstrip() # If we hit the next version header, we're done - if line.startswith(package): + if looks_like_a_header(line, package): break # Else, if we hit a blank line and we're still reading the release # name, we're done with the release name. @@ -50,7 +59,7 @@ GIT_URL = 'http://cgit.freedesktop.org/telepathy' def main(package, version, news_path): release_name, details = extract_description(package, version, news_path) - print """ + print(""" %(release_name)s tarball: %(base_url)s/%(package)s/%(package)s-%(version)s.tar.gz @@ -64,14 +73,14 @@ git: %(git_url)s/%(package)s 'version': version, 'release_name': release_name, 'details': details, - } + }) if __name__ == '__main__': try: package, version, news_path = sys.argv[1:] main(package, version, news_path) - except ValueError, e: + except ValueError as e: sys.stderr.write( 'Usage: %s package-name package.version.number path/to/NEWS\n' % sys.argv[0]) -- cgit v1.2.1 From 07d021e5e1c11e9ecda0907038bb7a6fa7f18c58 Mon Sep 17 00:00:00 2001 From: David Heidelberg Date: Sun, 27 Oct 2019 17:25:35 +0100 Subject: fix compilation on GCC 9.x, add #pragma Fixes: In function 'strncpy', inlined from 'idle_server_connection_send_async' at idle-server-connection.c:593:2: /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound 512 equals destination size [-Werror=stringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: David Heidelberg --- src/idle-server-connection.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/idle-server-connection.c b/src/idle-server-connection.c index 878b199..c463fe0 100644 --- a/src/idle-server-connection.c +++ b/src/idle-server-connection.c @@ -590,7 +590,10 @@ void idle_server_connection_send_async(IdleServerConnection *conn, const gchar * * with null bytes gives us cleaner debug messages, without * affecting the readability of the code. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(priv->output_buffer, cmd, output_buffer_size); +#pragma GCC diagnostic pop priv->nwritten = 0; -- cgit v1.2.1 From c1ae3d2bdc7801cdf60adb6a5cdb6390a0749014 Mon Sep 17 00:00:00 2001 From: Daniel Landau Date: Wed, 9 Nov 2016 00:09:17 +0200 Subject: Channel names can start with a '!' According to RFC2811 (https://tools.ietf.org/html/rfc2811#section-3.2) channel names can start with a bang. Without this check the initial bang gets stripped out and Telepathy tries to ensure as a channel without the prefix. That obviously fails, leading to the messages from that channel arriving as "private" messages. --- src/idle-parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/idle-parser.c b/src/idle-parser.c index 71ca8b1..2d0ec17 100644 --- a/src/idle-parser.c +++ b/src/idle-parser.c @@ -518,7 +518,9 @@ static gboolean _parse_atom(IdleParser *parser, GValueArray *arr, char atom, con gchar *id, *bang = NULL; gchar modechar = '\0'; - if (idle_muc_channel_is_modechar(token[0])) { + /* Channel names can start with a '!', so don't strip that + * (https://tools.ietf.org/html/rfc2811#section-3.2) */ + if (atom != 'r' && idle_muc_channel_is_modechar(token[0])) { modechar = token[0]; token++; } -- cgit v1.2.1 From 71ea7e98a1e68c5a51b0a36e662a95d07a04a3d7 Mon Sep 17 00:00:00 2001 From: Daniel Landau Date: Wed, 9 Nov 2016 21:27:11 +0200 Subject: Handle modechars properly Never strip out modechars unless we are explicitly trying to parse a nickname with modechars, i.e., atom 'C' --- src/idle-parser.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/idle-parser.c b/src/idle-parser.c index 2d0ec17..b0cab94 100644 --- a/src/idle-parser.c +++ b/src/idle-parser.c @@ -519,8 +519,12 @@ static gboolean _parse_atom(IdleParser *parser, GValueArray *arr, char atom, con gchar modechar = '\0'; /* Channel names can start with a '!', so don't strip that - * (https://tools.ietf.org/html/rfc2811#section-3.2) */ - if (atom != 'r' && idle_muc_channel_is_modechar(token[0])) { + * (https://tools.ietf.org/html/rfc2811#section-3.2), not + * even when expecting a nickname (without mode chars) as + * that ends up for example messing up PRIMSG handling and + * showing the same message as both a channel and a private + * message */ + if (atom == 'C' && idle_muc_channel_is_modechar(token[0])) { modechar = token[0]; token++; } -- cgit v1.2.1 From 108e30c59bf2c7f96611129c67d060f232ddbaf4 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 18 Nov 2018 16:12:13 +0100 Subject: build: Add meson build system --- .gitignore | 1 + data/meson.build | 13 ++++++ extensions/_gen/meson.build | 58 +++++++++++++++++++++++++ extensions/meson.build | 29 +++++++++++++ meson.build | 87 ++++++++++++++++++++++++++++++++++++++ meson_options.txt | 13 ++++++ src/meson.build | 52 +++++++++++++++++++++++ tests/meson.build | 37 ++++++++++++++++ tests/twisted/config.py.in | 1 + tests/twisted/meson.build | 93 +++++++++++++++++++++++++++++++++++++++++ tests/twisted/tools/meson.build | 22 ++++++++++ 11 files changed, 406 insertions(+) create mode 100644 data/meson.build create mode 100644 extensions/_gen/meson.build create mode 100644 extensions/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 src/meson.build create mode 100644 tests/meson.build create mode 100644 tests/twisted/config.py.in create mode 100644 tests/twisted/meson.build create mode 100644 tests/twisted/tools/meson.build diff --git a/.gitignore b/.gitignore index 33cf615..a6ed882 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ Makefile.in data/org.freedesktop.Telepathy.ConnectionManager.idle.service extensions/_gen +!extensions/_gen/meson.build extensions/extensions.html src/telepathy-idle diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..2edead8 --- /dev/null +++ b/data/meson.build @@ -0,0 +1,13 @@ +# Telepathy manager file +install_data( + 'idle.manager', + install_dir: managerdir, +) + +# Dbus service file +configure_file( + input: 'org.freedesktop.Telepathy.ConnectionManager.idle.service.in', + output: '@BASENAME@', + configuration: pathconf, + install_dir: dbus_services_dir, +) diff --git a/extensions/_gen/meson.build b/extensions/_gen/meson.build new file mode 100644 index 0000000..9f40cdd --- /dev/null +++ b/extensions/_gen/meson.build @@ -0,0 +1,58 @@ +xsltproc_with_flags = [xsltproc, '--nonet', '--novalid'] + +gen_all_xml = custom_target( + 'all.xml', + input: [ + join_paths(tools_dir, 'identity.xsl'), + join_paths('..', 'all.xml'), + ], + output: 'all.xml', + command: xsltproc_with_flags + ['--xinclude', '@INPUT@'], + capture: true, +) + +gen_svc = custom_target( + 'svc', + input: [ + join_paths(tools_dir, 'glib-ginterface-gen.py'), + gen_all_xml, + ], + output: [ + 'svc.h', + 'svc-gtk-doc.h', + 'svc.c', + ], + command: [ + python2, + '@INPUT0@', + '--filename=extensions/_gen/svc', + '--signal-marshal-prefix=_idle_ext', + '--include=', + '--not-implemented-func=tp_dbus_g_method_return_not_implemented', + '--allow-unstable', + '@INPUT1@', + 'Idle_Svc_', + ], +) + +gen_enums_h = custom_target( + 'enums.h', + input: [ + join_paths(tools_dir, 'c-constants-generator.xsl'), + gen_all_xml, + ], + output: 'enums.h', + command: xsltproc_with_flags + ['--stringparam', 'mixed-case-prefix', 'Idle', '@INPUT@'], + capture: true, +) + +gen_interfaces_h = custom_target( + 'interfaces.h', + input: [ + join_paths(tools_dir, 'c-interfaces-generator.xsl'), + gen_all_xml, + ], + output: 'interfaces.h', + command: xsltproc_with_flags + ['--stringparam', 'mixed-case-prefix', 'Idle', '@INPUT@'], + capture: true, +) diff --git a/extensions/meson.build b/extensions/meson.build new file mode 100644 index 0000000..388820d --- /dev/null +++ b/extensions/meson.build @@ -0,0 +1,29 @@ +xmls = files( + 'all.xml', + 'Connection_Interface_IRC_Command1.xml', +) + +subdir('_gen') + +libidle_extensions = library( + 'idle-extensions', + sources: [ + 'extensions.h', + gen_svc[2], + gen_enums_h, + gen_interfaces_h, + ], + dependencies: idle_deps, + include_directories: include_directories('..'), +) + +gen_extensions_html = custom_target( + 'extensions.html', + input: [ + join_paths(tools_dir, 'doc-generator.xsl'), + gen_all_xml, + ], + output: 'extensions.html', + command: xsltproc_with_flags + ['@INPUT@'], + capture: true, +) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..f2839fe --- /dev/null +++ b/meson.build @@ -0,0 +1,87 @@ +# 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 + +project( + 'telepathy-idle', + 'c', + version: '0.2.0.1', + default_options: [ + 'c_std=c99', + ], + meson_version: '>= 0.50.0', +) + +package_string = '@0@-@1@'.format(meson.project_name(), meson.project_version()) + +cc = meson.get_compiler('c') + +glib = dependency('glib-2.0', version: '>= 2.32.0') +gobject = dependency('gobject-2.0', version: '>= 2.32.0') +gio = dependency('gio-2.0', version: '>= 2.32.0') +dbus = dependency('dbus-1', version: '>= 0.51') +dbus_glib = dependency('dbus-glib-1', version: '>= 0.51') +telepathy_glib = dependency('telepathy-glib', version: '>= 0.23.0') + +idle_deps = [ + glib, + gobject, + gio, + dbus, + dbus_glib, + telepathy_glib, +] + +xsltproc = find_program('xsltproc') +python2 = import('python').find_installation('python2') + +# check for a version of python that can run the twisted tests +if get_option('twisted_tests') + if run_command(python2, '-c', '''from sys import version_info; import dbus, dbus.mainloop.glib; raise SystemExit(version_info < (2, 5, 0, 'final', 0))''').returncode() != 0 or run_command(python2, '-c', '''import twisted.words.protocols.irc, twisted.internet.reactor''').returncode() != 0 + error('Missing twisted IRC support') + endif + + test_python = python2.path() +endif + +# Directories + +datadir = join_paths(get_option('prefix'), get_option('datadir')) +libexecdir = join_paths(get_option('prefix'), get_option('libexecdir')) +pkglibexecdir = join_paths(libexecdir, meson.project_name()) +dbus_services_dir = join_paths(datadir, 'dbus-1', 'services') +managerdir = join_paths(datadir, 'telepathy', 'managers') + +# Configuration + +conf_data = configuration_data() +conf_data.set_quoted('DBUS_SERVICES_DIR', dbus_services_dir, description: 'DBus services directory') +conf_data.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_28', description: 'Ignore post 2.28 deprecations') +conf_data.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_32', description: 'Prevent post 2.32 APIs') +conf_data.set('TP_SEAL_ENABLE', '', description: 'Prevent to use sealed variables') +conf_data.set('TP_DISABLE_SINGLE_INCLUDE', '', description: 'Disable single header include') +conf_data.set('TP_VERSION_MIN_REQUIRED', 'TP_VERSION_0_24', description: 'Ignore post 0.24 deprecations') +conf_data.set('TP_VERSION_MAX_ALLOWED', 'TP_VERSION_0_24', description: 'Prevent post 0.24 APIs') +conf_data.set_quoted('VERSION', meson.project_version()) +if cc.has_function('strnlen') + conf_data.set10('HAVE_STRNLEN', true) +endif + +configure_file( + output: 'config.h', + configuration: conf_data, +) + +configuration_inc = include_directories('.') +src_inc = include_directories('src') +tools_dir = join_paths(meson.current_source_dir(), 'tools') + +subdir('extensions') +subdir('src') +subdir('data') +subdir('tests') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..01583da --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,13 @@ +option( + 'twisted_tests', + type: 'boolean', + value: true, + description: 'Enable tests using Python with Twisted and IRC protocol support', +) + +option( + 'twisted_sleep', + type: 'string', + value: '0', + description: 'Number of seconds to sleep in twisted tests', +) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..c264c02 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,52 @@ +libidle_convenience = library( + 'idle-convenience', + sources: [ + 'idle-connection.c', + 'idle-connection-manager.c', + 'idle-contact-info.c', + 'idle-ctcp.c', + 'idle-debug.c', + 'idle-handles.c', + 'idle-im-channel.c', + 'idle-im-manager.c', + 'idle-muc-channel.c', + 'idle-muc-manager.c', + 'room-config.c', + 'idle-parser.c', + 'protocol.c', + 'idle-roomlist-channel.c', + 'idle-roomlist-manager.c', + 'idle-server-connection.c', + 'idle-text.c', + 'server-tls-channel.c', + 'server-tls-manager.c', + 'tls-certificate.c', + gen_enums_h, # required by libidle_extensions + ], + dependencies: idle_deps, + include_directories: configuration_inc, + link_with: libidle_extensions, +) + +executable( + 'telepathy-idle', + sources: [ + 'idle.c' + ], + dependencies: idle_deps, + include_directories: configuration_inc, + install: true, + install_dir: libexecdir, + link_with: libidle_convenience, +) + +pathconf = configuration_data() +pathconf.set('libexecdir', libexecdir) + +telepathy_idle_8 = configure_file( + configuration: pathconf, + input: 'telepathy-idle.8.in', + output: '@BASENAME@', +) + +install_man(telepathy_idle_8) diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..626168c --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,37 @@ + +test_ctcp_tokenize = executable( + 'test-ctcp-tokenize', + sources: [ + 'test-ctcp-tokenize.c', + ], + dependencies: idle_deps, + include_directories: [configuration_inc, src_inc], + link_with: libidle_convenience, +) +test('test_ctcp_tokenize', test_ctcp_tokenize) + +test_ctcp_kill_blingbling = executable( + 'test-ctcp-kill-blingbling', + sources: [ + 'test-ctcp-kill-blingbling.c', + ], + dependencies: idle_deps, + include_directories: [configuration_inc, src_inc], + link_with: libidle_convenience, +) +test('test_ctcp_kill_blingbling', test_ctcp_kill_blingbling) + +test_text_encode_and_split = executable( + 'test-text-encode-and-split', + sources: [ + 'test-text-encode-and-split.c', + ], + dependencies: idle_deps, + include_directories: [configuration_inc, src_inc], + link_with: libidle_convenience, +) +test('test_text_encode_and_split', test_text_encode_and_split) + +if get_option('twisted_tests') + subdir('twisted') +endif diff --git a/tests/twisted/config.py.in b/tests/twisted/config.py.in new file mode 100644 index 0000000..d0228f1 --- /dev/null +++ b/tests/twisted/config.py.in @@ -0,0 +1 @@ +PACKAGE_STRING = "@PACKAGE_STRING@" diff --git a/tests/twisted/meson.build b/tests/twisted/meson.build new file mode 100644 index 0000000..7e39d4b --- /dev/null +++ b/tests/twisted/meson.build @@ -0,0 +1,93 @@ +twisted_tests = [ + 'cm/protocol.py', + 'connect/connect-close-ssl.py', + 'connect/connect-success.py', + 'connect/connect-success-ssl.py', + 'connect/connect-reject-ssl.py', + 'connect/connect-fail.py', + 'connect/connect-fail-ssl.py', + 'connect/disconnect-before-socket-connected.py', + 'connect/disconnect-during-cert-verification.py', + 'connect/ping.py', + 'connect/server-quit-ignore.py', + 'connect/server-quit-noclose.py', + 'connect/socket-closed-after-handshake.py', + 'connect/socket-closed-during-handshake.py', + 'connect/invalid-nick.py', + 'contacts.py', + 'channels/join-muc-channel.py', + 'channels/join-muc-channel-bouncer.py', + 'channels/requests-create.py', + 'channels/requests-muc.py', + 'channels/muc-channel-topic.py', + 'channels/muc-destroy.py', + 'channels/room-list-channel.py', + 'channels/room-list-multiple.py', + 'irc-command.py', + 'messages/accept-invalid-nicks.py', + 'messages/contactinfo-request.py', + 'messages/invalid-utf8.py', + 'messages/messages-iface.py', + 'messages/message-order.py', + 'messages/leading-space.py', + 'messages/long-message-split.py', + 'messages/room-contact-mixup.py', + 'messages/room-config.py', +] + +twisted_conf = configuration_data() +twisted_conf.set_quoted('PACKAGE_STRING', package_string) + +configure_file( + input: 'config.py.in', + output: '@BASENAME@', + configuration: twisted_conf, +) + +if get_option('twisted_sleep') == '0' + idle_test_sleep = '' +else + idle_test_sleep = '--sleep=@0@'.format(get_option('twisted_sleep')) +endif + +# idle-twisted-tests.list +test_list = custom_target('idle-twisted-tests.list', + output: 'idle-twisted-tests.list', + command: ['echo', '\n'.join(twisted_tests)], + capture: true, +) + +# We don't really use idletestsdir yet - we only support uninstalled testing +# so far - but I'm substituting it to keep the script more similar to Gabble's. +# ${pkglibexecdir}/tests is what GNOME's InstalledTests goal recommends. + +abs_top_srcdir = meson.source_root() +abs_top_builddir = meson.build_root() + +run_test_conf = configuration_data() +run_test_conf.set('idletestsdir', join_paths(pkglibexecdir, 'tests')) +run_test_conf.set('TEST_PYTHON', test_python) + +run_test = configure_file( + input: 'run-test.sh.in', + output: '@BASENAME@', + configuration: run_test_conf, +) + +test( + 'check', + run_test, + args: twisted_tests, + env: [ + 'IDLE_TEST_UNINSTALLED=1', + 'IDLE_ABS_TOP_SRCDIR=@0@'.format(abs_top_srcdir), + 'IDLE_ABS_TOP_BUILDDIR=@0@'.format(abs_top_builddir), + 'IDLE_TEST_SLEEP=@0@'.format(idle_test_sleep), + ], + depends: [ + test_list, + ], + suite: 'twisted', +) + +subdir('tools') diff --git a/tests/twisted/tools/meson.build b/tests/twisted/tools/meson.build new file mode 100644 index 0000000..c3d28b6 --- /dev/null +++ b/tests/twisted/tools/meson.build @@ -0,0 +1,22 @@ +ewl_conf = configuration_data() +ewl_conf.set('abs_top_builddir', abs_top_builddir) +ewl_conf.set('abs_top_srcdir', abs_top_srcdir) + +configure_file( + input: 'exec-with-log.sh.in', + output: '@BASENAME@', + configuration: ewl_conf, +) + +configure_file( + input: 'tmp-session-bus.conf.in', + output: '@BASENAME@', + configuration: ewl_conf, +) + +# D-Bus service file for testing +configure_file( + input: 'idle.service.in', + output: 'org.freedesktop.Telepathy.ConnectionManager.idle.service', + configuration: ewl_conf, +) -- cgit v1.2.1 From b0f139ff63c4d5f9471423422f298443ae222f9a Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Sun, 1 Nov 2020 01:20:32 +0300 Subject: Prepare 0.2.1 --- NEWS | 30 ++++++++++++++++++++++++++++++ configure.ac | 4 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c7a37cb..f18071d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,33 @@ + +telepathy-idle 0.2.1 (2020-11-01) +================================== + + +Enhancements: + +• Port build tools to Python 3 (Michael Catanzaro) + +• Add meson build system (Jan Tojnar) + +Fixes: + +• Update test to Python 3 (Tomi Leppänen) + +• Properly handle long IRC messages (polari#147, Michael Catanzaro) + +• Fix a critical message from GLib on disconnecting (Guillaume, Diane Trout) + +• Fix message corruption on accident bling removal (Florian Muellner) + +• Update the certificate for tests (Diane Trout) + +• Fix "Invalid utf8" test for Python 3 (Diane Trout) + +• Properly handle channels with a '!' at the start of name (Daniel Landau) + +• Properly handle modechars (Daniel Landau) + + telepathy-idle 0.2.0 (2013-10-03) ================================= diff --git a/configure.ac b/configure.ac index 54ce94c..45f7b12 100644 --- a/configure.ac +++ b/configure.ac @@ -11,8 +11,8 @@ AC_PREREQ([2.59]) m4_define([idle_major_version], [0]) m4_define([idle_minor_version], [2]) -m4_define([idle_micro_version], [0]) -m4_define([idle_nano_version], [1]) +m4_define([idle_micro_version], [1]) +m4_define([idle_nano_version], [0]) m4_define([idle_base_version], [idle_major_version.idle_minor_version.idle_micro_version]) -- cgit v1.2.1