Skip to content

Commit

Permalink
Chatty: new port, messenger for Matrix protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Oct 10, 2024
1 parent d70f2d2 commit b730144
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
66 changes: 66 additions & 0 deletions gnome/Chatty/Portfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0
PortGroup compiler_blacklist_versions 1.0
PortGroup gitlab 1.0
PortGroup meson 1.0

gitlab.instance https://gitlab.gnome.org
gitlab.setup World Chatty 0.8.5 v
revision 0
categories gnome
license GPL-3
maintainers nomaintainer

description SMS/MMS, Matrix and (optionally) XMPP messaging
long_description {*}${description} via ModemManager, mmsd-tng, libcmatrix \
and libpurple.
use_bzip2 yes

checksums rmd160 0616bcda715da407e0cb5525d37573c0691762bb \
sha256 a613e44b1bf1d5e1d1332cc7233f7edfd141ac06f17c3a0833e0e4c65c37d858 \
size 1516194

meson.wrap_mode nodownload

# https://gitlab.gnome.org/World/Chatty/-/issues/950
patchfiles-append patch-strchrnul.diff

depends_build-append \
port:appstream \
port:gettext \
port:itstool \
path:bin/pkg-config:pkgconfig

depends_lib-append path:lib/pkgconfig/cairo.pc:cairo \
port:desktop-file-utils \
port:evolution-data-server-gtk4 \
path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
port:gettext-runtime \
path:lib/pkgconfig/glib-2.0.pc:glib2 \
port:gnome-desktop-gtk4 \
path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection \
port:gstreamer1 \
path:lib/pkgconfig/gtk+-4.0.pc:gtk4 \
port:gtksourceview5 \
port:libadwaita \
port:libcmatrix \
port:libfeedback \
port:libmm-glib \
port:libphonenumber-cpp \
port:libpurple \
path:lib/pkgconfig/pango.pc:pango \
port:sqlite3

depends_run-append port:gsettings-desktop-schemas

# protobuf3-cpp used by libphonenumber-cpp needs at least C++11,
# also: https://gitlab.gnome.org/World/Chatty/-/issues/951
compiler.cxx_standard 2014
compiler.blacklist-append \
{clang} {macports-clang-1[1-7]}

post-activate {
system "${prefix}/bin/gtk4-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}
42 changes: 42 additions & 0 deletions gnome/Chatty/files/patch-strchrnul.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--- src/mm/chatty-sms-uri.c.orig 2024-08-22 02:36:26
+++ src/mm/chatty-sms-uri.c 2024-10-10 18:52:36
@@ -22,6 +22,15 @@
#include "chatty-sms-uri.h"
#include "chatty-log.h"

+#ifdef __APPLE__
+static const char *chatty_strchrnul(const char *s, int c) {
+ const char *ptr = strchr(s, c);
+ if (!ptr)
+ ptr = s + strlen(s);
+ return ptr;
+}
+#endif
+
/**
* SECTION: chatty-sms-uri
* @title: ChattySmsUri
@@ -120,7 +129,11 @@
return;

self->numbers_valid = TRUE;
+#ifdef __APPLE__
+ end = chatty_strchrnul (self->uri, '?');
+#else
end = strchrnul (self->uri, '?');
+#endif
numbers = g_strndup (self->uri, end - self->uri);
number_start = numbers;

@@ -172,7 +185,11 @@
goto end;

body = body + strlen ("body=");
+ #ifdef __APPLE__
+ end = chatty_strchrnul (body, '&');
+ #else
end = strchrnul (body, '&');
+ #endif
text = g_strndup (body, end - body);

self->body = g_uri_unescape_string (text, NULL);

0 comments on commit b730144

Please sign in to comment.