diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c40cf4b0..daae84d0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - flavor: [debian, fedora] + flavor: [debian, fedora, tumbleweed, ubuntu] name: Linux steps: @@ -22,15 +22,15 @@ jobs: docker build -f Dockerfile.${{ matrix.flavor }} -t profanity . docker run profanity ./ci-build.sh -# macos: -# runs-on: macos-latest -# name: macOS -# steps: -# - uses: actions/checkout@v2 -# - name: Run brew bundle -# run: brew bundle -# - name: Run tests -# env: -# # Ensure that "keg-only" Homebrew versions are used. -# PKG_CONFIG_PATH: "/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig:/usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/sqlite/lib/pkgconfig:$PKG_CONFIG_PATH" -# run: ./ci-build.sh + macos: + runs-on: macos-latest + name: macOS + steps: + - uses: actions/checkout@v2 + - name: Run brew bundle + run: brew bundle + - name: Run tests + env: + # Ensure that "keg-only" Homebrew versions are used. + PKG_CONFIG_PATH: "/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig:/usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/sqlite/lib/pkgconfig:$PKG_CONFIG_PATH" + run: ./ci-build.sh diff --git a/Dockerfile.arch b/Dockerfile.arch index a3644b9f..1cd4cd03 100644 --- a/Dockerfile.arch +++ b/Dockerfile.arch @@ -1,4 +1,4 @@ -FROM archlinux/base +FROM archlinux/latest RUN pacman -Syu --noconfirm && pacman -S --needed --noconfirm \ autoconf \ diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 840cd736..9686084f 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -26,7 +26,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libxss-dev \ make \ pkg-config \ - python-dev \ + python3-dev \ + python-dev-is-python3 \ libsqlite3-dev RUN mkdir -p /usr/src/{stabber,libstrophe,profanity} diff --git a/configure.ac b/configure.ac index 566c3c80..4a6a8ba2 100644 --- a/configure.ac +++ b/configure.ac @@ -210,12 +210,21 @@ AS_IF([test "x$enable_icons_and_clipboard" != xno], [AC_MSG_NOTICE([gtk+-3.0/gtk+2.0 not found, icons and clipboard not enabled])])])])]) AS_IF([test "x$PLATFORM" = xosx], - [AC_CHECK_FILE([/usr/local/opt/readline/lib], + [AC_PATH_PROG([BREW], [brew], ["failed"], + [$PATH:/opt/homebrew/bin:/usr/local/bin]) + AS_IF([test "x$BREW" = xfailed], + [AC_CHECK_FILE([/opt/local/lib/libreadline.dylib], + [READLINE_PREFIX="/opt/local"], + [READLINE_PREFIX="/usr/local"])], + [READLINE_PREFIX="`$BREW --prefix readline`"])]) + +AS_IF([test "x$PLATFORM" = xosx], + [AC_CHECK_FILE([$READLINE_PREFIX/lib/libreadline.dylib], [LIBS="-lreadline $LIBS" - AM_CPPFLAGS="-I/usr/local/opt/readline/include $AM_CPPFLAGS" - AM_LDFLAGS="-L/usr/local/opt/readline/lib $AM_LDFLAGS" + AM_CPPFLAGS="-I$READLINE_PREFIX/include $AM_CPPFLAGS" + AM_LDFLAGS="-L$READLINE_PREFIX/lib $AM_LDFLAGS" AC_SUBST(AM_LDFLAGS)], - [AC_MSG_ERROR([libreadline is required for profanity])])], + [AC_MSG_ERROR([libreadline is required for profanity. Install it with Homebrew, MacPorts, or manually into /usr/local])])], [test "x$PLATFORM" = xopenbsd], [AC_CHECK_FILE([/usr/local/include/ereadline], diff --git a/src/omemo/omemo.c b/src/omemo/omemo.c index e1126e62..4d53ad0c 100644 --- a/src/omemo/omemo.c +++ b/src/omemo/omemo.c @@ -84,6 +84,7 @@ static unsigned char* _omemo_fingerprint_decode(const char* const fingerprint, s static char* _omemo_unformat_fingerprint(const char* const fingerprint_formatted); static void _cache_device_identity(const char* const jid, uint32_t device_id, ec_public_key* identity); static void _g_hash_table_free(GHashTable* hash_table); +static void _acquire_sender_devices_list(void); typedef gboolean (*OmemoDeviceListHandler)(const char* const jid, GList* device_list); @@ -384,21 +385,26 @@ omemo_publish_crypto_materials(void) return; } + omemo_bundle_publish(true); +} + +static void _acquire_sender_devices_list(void) { char* barejid = connection_get_barejid(); - /* Ensure we get our current device list, and it gets updated with our - * device_id */ g_hash_table_insert(omemo_ctx.device_list_handler, strdup(barejid), _handle_own_device_list); omemo_devicelist_request(barejid); - omemo_bundle_publish(true); - free(barejid); } void omemo_start_sessions(void) { + // before any session may be started, a list on + // available sender devices must be acquired + log_debug("[OMEMO] Acquiring sender devices list"); + _acquire_sender_devices_list(); + GSList* contacts = roster_get_contacts(ROSTER_ORD_NAME); if (contacts) { GSList* curr; diff --git a/src/plugins/callbacks.c b/src/plugins/callbacks.c index 92c0a9f4..4a73f15b 100644 --- a/src/plugins/callbacks.c +++ b/src/plugins/callbacks.c @@ -82,7 +82,7 @@ _free_command_help(CommandHelp* help) free(help->desc); i = 0; - while (help->args[i] != NULL && help->args[i][0] != NULL) { + while (help->args[i][0] != NULL) { free(help->args[i][0]); free(help->args[i][1]); i++; diff --git a/src/plugins/python_api.c b/src/plugins/python_api.c index 8ea54514..90e33579 100644 --- a/src/plugins/python_api.c +++ b/src/plugins/python_api.c @@ -158,7 +158,7 @@ python_api_register_command(PyObject* self, PyObject* args) c_synopsis[len] = NULL; Py_ssize_t args_len = PyList_Size(arguments); - char* c_arguments[args_len == 0 ? 0 : args_len + 1][2]; + char* c_arguments[args_len + 1][2]; for (i = 0; i < args_len; i++) { PyObject* item = PyList_GetItem(arguments, i); Py_ssize_t len2 = PyList_Size(item); @@ -196,7 +196,7 @@ python_api_register_command(PyObject* self, PyObject* args) free(c_synopsis[i++]); } i = 0; - while (c_arguments[i] != NULL && c_arguments[i][0] != NULL) { + while (c_arguments[i][0] != NULL) { free(c_arguments[i][0]); free(c_arguments[i][1]); i++; diff --git a/src/xmpp/message.c b/src/xmpp/message.c index ab4d48c6..70371576 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -231,7 +231,13 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con gboolean is_carbon = FALSE; // XEP-0280: Message Carbons - xmpp_stanza_t* carbons = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CARBONS); + // Only allow `` and `` carbons + // Thus ignoring `` + xmpp_stanza_t* carbons = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_SENT, STANZA_NS_CARBONS); + if (!carbons) { + carbons = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_RECEIVED, STANZA_NS_CARBONS); + } + if (carbons) { // carbon must come from ourselves @@ -1291,7 +1297,7 @@ _handle_carbons(xmpp_stanza_t* const stanza) } */ - if ((g_strcmp0(name, "received") != 0) && (g_strcmp0(name, "sent") != 0)) { + if ((g_strcmp0(name, STANZA_NAME_RECEIVED) != 0) && (g_strcmp0(name, STANZA_NAME_SENT) != 0)) { log_warning("Carbon received with unrecognised stanza name: %s", name); return NULL; } diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h index b4c65641..9e957749 100644 --- a/src/xmpp/stanza.h +++ b/src/xmpp/stanza.h @@ -119,6 +119,8 @@ #define STANZA_NAME_REPORT "report" #define STANZA_NAME_EVENT "event" #define STANZA_NAME_MOOD "mood" +#define STANZA_NAME_RECEIVED "received" +#define STANZA_NAME_SENT "sent" // error conditions #define STANZA_NAME_BAD_REQUEST "bad-request"