diff options
-rw-r--r-- | configure.ac | 17 | ||||
-rw-r--r-- | src/xmpp/message.c | 10 | ||||
-rw-r--r-- | src/xmpp/stanza.h | 2 |
3 files changed, 23 insertions, 6 deletions
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/xmpp/message.c b/src/xmpp/message.c index 1a964846..4aa22437 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -223,7 +223,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 `<sent xmlns='urn:xmpp:carbons:2'>` and `<received xmlns='urn:xmpp:carbons:2'>` carbons + // Thus ignoring `<private xmlns="urn:xmpp:carbons:2"/>` + 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 @@ -1283,7 +1289,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 e2c22bd8..7aac5d08 100644 --- a/src/xmpp/stanza.h +++ b/src/xmpp/stanza.h @@ -117,6 +117,8 @@ #define STANZA_NAME_USERNAME "username" #define STANZA_NAME_PROPOSE "propose" #define STANZA_NAME_REPORT "report" +#define STANZA_NAME_RECEIVED "received" +#define STANZA_NAME_SENT "sent" // error conditions #define STANZA_NAME_BAD_REQUEST "bad-request" |