1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into xep/xep0107-user-mood

This commit is contained in:
Michael Vetter 2021-12-06 13:49:04 +01:00 committed by GitHub
commit b67054aa39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 52 additions and 28 deletions

View File

@ -12,7 +12,7 @@ jobs:
strategy: strategy:
matrix: matrix:
flavor: [debian, fedora] flavor: [debian, fedora, tumbleweed, ubuntu]
name: Linux name: Linux
steps: steps:
@ -22,15 +22,15 @@ jobs:
docker build -f Dockerfile.${{ matrix.flavor }} -t profanity . docker build -f Dockerfile.${{ matrix.flavor }} -t profanity .
docker run profanity ./ci-build.sh docker run profanity ./ci-build.sh
# macos: macos:
# runs-on: macos-latest runs-on: macos-latest
# name: macOS name: macOS
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# - name: Run brew bundle - name: Run brew bundle
# run: brew bundle run: brew bundle
# - name: Run tests - name: Run tests
# env: env:
# # Ensure that "keg-only" Homebrew versions are used. # 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" 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 run: ./ci-build.sh

View File

@ -1,4 +1,4 @@
FROM archlinux/base FROM archlinux/latest
RUN pacman -Syu --noconfirm && pacman -S --needed --noconfirm \ RUN pacman -Syu --noconfirm && pacman -S --needed --noconfirm \
autoconf \ autoconf \

View File

@ -26,7 +26,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libxss-dev \ libxss-dev \
make \ make \
pkg-config \ pkg-config \
python-dev \ python3-dev \
python-dev-is-python3 \
libsqlite3-dev libsqlite3-dev
RUN mkdir -p /usr/src/{stabber,libstrophe,profanity} RUN mkdir -p /usr/src/{stabber,libstrophe,profanity}

View File

@ -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])])])])]) [AC_MSG_NOTICE([gtk+-3.0/gtk+2.0 not found, icons and clipboard not enabled])])])])])
AS_IF([test "x$PLATFORM" = xosx], 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" [LIBS="-lreadline $LIBS"
AM_CPPFLAGS="-I/usr/local/opt/readline/include $AM_CPPFLAGS" AM_CPPFLAGS="-I$READLINE_PREFIX/include $AM_CPPFLAGS"
AM_LDFLAGS="-L/usr/local/opt/readline/lib $AM_LDFLAGS" AM_LDFLAGS="-L$READLINE_PREFIX/lib $AM_LDFLAGS"
AC_SUBST(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], [test "x$PLATFORM" = xopenbsd],
[AC_CHECK_FILE([/usr/local/include/ereadline], [AC_CHECK_FILE([/usr/local/include/ereadline],

View File

@ -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 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 _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 _g_hash_table_free(GHashTable* hash_table);
static void _acquire_sender_devices_list(void);
typedef gboolean (*OmemoDeviceListHandler)(const char* const jid, GList* device_list); typedef gboolean (*OmemoDeviceListHandler)(const char* const jid, GList* device_list);
@ -384,21 +385,26 @@ omemo_publish_crypto_materials(void)
return; return;
} }
omemo_bundle_publish(true);
}
static void _acquire_sender_devices_list(void) {
char* barejid = connection_get_barejid(); 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); g_hash_table_insert(omemo_ctx.device_list_handler, strdup(barejid), _handle_own_device_list);
omemo_devicelist_request(barejid); omemo_devicelist_request(barejid);
omemo_bundle_publish(true);
free(barejid); free(barejid);
} }
void void
omemo_start_sessions(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); GSList* contacts = roster_get_contacts(ROSTER_ORD_NAME);
if (contacts) { if (contacts) {
GSList* curr; GSList* curr;

View File

@ -82,7 +82,7 @@ _free_command_help(CommandHelp* help)
free(help->desc); free(help->desc);
i = 0; 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][0]);
free(help->args[i][1]); free(help->args[i][1]);
i++; i++;

View File

@ -158,7 +158,7 @@ python_api_register_command(PyObject* self, PyObject* args)
c_synopsis[len] = NULL; c_synopsis[len] = NULL;
Py_ssize_t args_len = PyList_Size(arguments); 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++) { for (i = 0; i < args_len; i++) {
PyObject* item = PyList_GetItem(arguments, i); PyObject* item = PyList_GetItem(arguments, i);
Py_ssize_t len2 = PyList_Size(item); Py_ssize_t len2 = PyList_Size(item);
@ -196,7 +196,7 @@ python_api_register_command(PyObject* self, PyObject* args)
free(c_synopsis[i++]); free(c_synopsis[i++]);
} }
i = 0; 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][0]);
free(c_arguments[i][1]); free(c_arguments[i][1]);
i++; i++;

View File

@ -231,7 +231,13 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con
gboolean is_carbon = FALSE; gboolean is_carbon = FALSE;
// XEP-0280: Message Carbons // 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) { if (carbons) {
// carbon must come from ourselves // 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); log_warning("Carbon received with unrecognised stanza name: %s", name);
return NULL; return NULL;
} }

View File

@ -119,6 +119,8 @@
#define STANZA_NAME_REPORT "report" #define STANZA_NAME_REPORT "report"
#define STANZA_NAME_EVENT "event" #define STANZA_NAME_EVENT "event"
#define STANZA_NAME_MOOD "mood" #define STANZA_NAME_MOOD "mood"
#define STANZA_NAME_RECEIVED "received"
#define STANZA_NAME_SENT "sent"
// error conditions // error conditions
#define STANZA_NAME_BAD_REQUEST "bad-request" #define STANZA_NAME_BAD_REQUEST "bad-request"