1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-09 21:30:42 +00:00

Merge pull request #1608 from sjaeckel/deprecate-libmesode

Deprecate libmesode
This commit is contained in:
Michael Vetter 2021-10-28 20:30:38 +02:00 committed by GitHub
commit cad934b9a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 54 additions and 199 deletions

View File

@ -23,7 +23,7 @@ packages:
- sqlite3
sources:
- https://github.com/profanity-im/libmesode.git#0.10.1
- https://github.com/strophe/libstrophe.git#0.11.0
- https://github.com/profanity-im/profanity
environment:
@ -38,7 +38,7 @@ tasks:
export AUTOCONF_VERSION=2.69
export AUTOMAKE_VERSION=1.16
cd ~/libmesode
cd ~/libstrophe
./bootstrap.sh
./configure
make

View File

@ -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

View File

@ -29,11 +29,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python-dev-is-python3 \
libsqlite3-dev
RUN mkdir -p /usr/src/{stabber,libmesode,profanity}
RUN mkdir -p /usr/src/{stabber,libstrophe,profanity}
WORKDIR /usr/src
RUN git clone git://github.com/boothj5/stabber.git
RUN git clone git://github.com/profanity-im/libmesode.git
RUN git clone git://github.com/strophe/libstrophe.git
WORKDIR /usr/src/stabber
RUN ./bootstrap.sh
@ -41,7 +41,7 @@ RUN ./configure --prefix=/usr --disable-dependency-tracking
RUN make
RUN make install
WORKDIR /usr/src/libmesode
WORKDIR /usr/src/libstrophe
RUN ./bootstrap.sh
RUN ./configure --prefix=/usr
RUN make

View File

@ -53,9 +53,9 @@ RUN make
RUN make install
WORKDIR /usr/src
RUN mkdir -p /usr/src/libmesode
RUN git clone git://github.com/profanity-im/libmesode.git
WORKDIR /usr/src/libmesode
RUN mkdir -p /usr/src/libstrophe
RUN git clone git://github.com/strophe/libstrophe.git
WORKDIR /usr/src/libstrophe
RUN ./bootstrap.sh
RUN ./configure --prefix=/usr
RUN make

View File

@ -20,7 +20,6 @@ RUN zypper --non-interactive in --no-recommends \
libexpat-devel \
libgcrypt-devel \
libgpgme-devel \
libmesode-devel \
libstrophe-devel \
libmicrohttpd-devel \
libnotify-devel \

View File

@ -29,11 +29,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python-dev \
libsqlite3-dev
RUN mkdir -p /usr/src/{stabber,libmesode,profanity}
RUN mkdir -p /usr/src/{stabber,libstrophe,profanity}
WORKDIR /usr/src
RUN git clone git://github.com/boothj5/stabber.git
RUN git clone git://github.com/profanity-im/libmesode.git
RUN git clone git://github.com/strophe/libstrophe.git
# TODO: Re-enable once libmicrohttpd-dev has been updated.
#WORKDIR /usr/src/stabber
@ -42,7 +42,7 @@ RUN git clone git://github.com/profanity-im/libmesode.git
#RUN make
#RUN make install
WORKDIR /usr/src/libmesode
WORKDIR /usr/src/libstrophe
RUN ./bootstrap.sh
RUN ./configure --prefix=/usr
RUN make

View File

@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_INIT([profanity], [0.12.0], [jubalh@iodoru.org])
AC_INIT([profanity],[0.12.0],[jubalh@iodoru.org])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/main.c])
@ -10,7 +10,7 @@ AM_INIT_AUTOMAKE([foreign subdir-objects])
### Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
LT_INIT
## Check for LFS
AC_SYS_LARGEFILE
@ -134,21 +134,14 @@ LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AS_IF([test "x$PTHREAD_CC" != x], [ CC="$PTHREAD_CC" ])
### Check for libmesode, fall back to libstrophe
### TODO libmesode support will be removed in the future, rewrite this section
PKG_CHECK_MODULES([libmesode], [libmesode >= 0.10.0],
[LIBS="$libmesode_LIBS $LIBS" CFLAGS="$CFLAGS $libmesode_CFLAGS" XMPP_LIB="libmesode" AC_DEFINE([HAVE_LIBMESODE], [1], [libmesode])],
[PKG_CHECK_MODULES([libstrophe], [libstrophe >= 0.10.0],
[LIBS="$libstrophe_LIBS $LIBS" CFLAGS="$CFLAGS $libstrophe_CFLAGS" XMPP_LIB="libstrophe" AC_DEFINE([HAVE_LIBSTROPHE], [1], [libstrophe])],
[XMPP_LIB=""])])
### Check for libstrophe
PKG_CHECK_MODULES([libstrophe], [libstrophe >= 0.11.0],
[LIBS="$libstrophe_LIBS $LIBS" CFLAGS="$CFLAGS $libstrophe_CFLAGS" XMPP_LIB="libstrophe" AC_DEFINE([HAVE_LIBSTROPHE], [1], [libstrophe])],
[XMPP_LIB=""])
AC_MSG_CHECKING([whether ${XMPP_LIB} works])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#else
#include <strophe.h>
#endif
int main() {
xmpp_initialize();

View File

@ -177,7 +177,6 @@ cmd_execute_connect(ProfWin* window, const char* const account)
gboolean
cmd_tls_certpath(ProfWin* window, const char* const command, gchar** args)
{
#ifdef HAVE_LIBMESODE
if (g_strcmp0(args[1], "set") == 0) {
if (args[2] == NULL) {
cons_bad_cmd_usage(command);
@ -212,16 +211,11 @@ cmd_tls_certpath(ProfWin* window, const char* const command, gchar** args)
cons_bad_cmd_usage(command);
return TRUE;
}
#else
cons_show("Certificate path setting only supported when built with libmesode.");
return TRUE;
#endif
}
gboolean
cmd_tls_trust(ProfWin* window, const char* const command, gchar** args)
{
#ifdef HAVE_LIBMESODE
jabber_conn_status_t conn_status = connection_get_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are currently not connected.");
@ -245,16 +239,11 @@ cmd_tls_trust(ProfWin* window, const char* const command, gchar** args)
tlscerts_add(cert);
tlscerts_free(cert);
return TRUE;
#else
cons_show("Manual certificate trust only supported when built with libmesode.");
return TRUE;
#endif
}
gboolean
cmd_tls_trusted(ProfWin* window, const char* const command, gchar** args)
{
#ifdef HAVE_LIBMESODE
GList* certs = tlscerts_list();
GList* curr = certs;
@ -272,16 +261,11 @@ cmd_tls_trusted(ProfWin* window, const char* const command, gchar** args)
}
g_list_free_full(certs, (GDestroyNotify)tlscerts_free);
return TRUE;
#else
cons_show("Manual certificate trust only supported when built with libmesode.");
return TRUE;
#endif
}
gboolean
cmd_tls_revoke(ProfWin* window, const char* const command, gchar** args)
{
#ifdef HAVE_LIBMESODE
if (args[1] == NULL) {
cons_bad_cmd_usage(command);
} else {
@ -293,16 +277,11 @@ cmd_tls_revoke(ProfWin* window, const char* const command, gchar** args)
}
}
return TRUE;
#else
cons_show("Manual certificate trust only supported when built with libmesode.");
return TRUE;
#endif
}
gboolean
cmd_tls_cert(ProfWin* window, const char* const command, gchar** args)
{
#ifdef HAVE_LIBMESODE
if (args[1]) {
TLSCertificate* cert = tlscerts_get_trusted(args[1]);
if (!cert) {
@ -332,10 +311,6 @@ cmd_tls_cert(ProfWin* window, const char* const command, gchar** args)
tlscerts_free(cert);
return TRUE;
}
#else
cons_show("Certificate fetching not supported.");
return TRUE;
#endif
}
gboolean

View File

@ -1088,7 +1088,6 @@ prefs_set_roster_header_char(char* ch)
}
}
void
prefs_clear_roster_header_char(void)
{

View File

@ -125,12 +125,7 @@ main(int argc, char** argv)
g_print("Build information:\n");
#ifdef HAVE_LIBMESODE
g_print("XMPP library: libmesode\n");
#endif
#ifdef HAVE_LIBSTROPHE
g_print("XMPP library: libstrophe\n");
#endif
if (is_notify_enabled()) {
g_print("Desktop notification support: Enabled\n");

View File

@ -314,7 +314,7 @@ _rosterwin_unsubscribed_item(ProfLayoutSplit* layout, ProfChatWin* chatwin)
indent--;
}
}
char *ch = prefs_get_roster_contact_char();
char* ch = prefs_get_roster_contact_char();
if (ch) {
g_string_append_printf(msg, "%s", ch);
free(ch);
@ -377,7 +377,7 @@ _rosterwin_contact(ProfLayoutSplit* layout, PContact contact)
indent--;
}
}
char *ch = prefs_get_roster_contact_char();
char* ch = prefs_get_roster_contact_char();
if (ch) {
g_string_append_printf(msg, "%s", ch);
free(ch);

View File

@ -38,13 +38,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include <glib.h>

View File

@ -41,13 +41,7 @@
#include <string.h>
#include <glib.h>
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "common.h"
#include "log.h"

View File

@ -45,13 +45,7 @@
#include <glib.h>
#include <glib/gstdio.h>
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "common.h"
#include "log.h"

View File

@ -38,13 +38,7 @@
#include "config.h"
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "xmpp/xmpp.h"

View File

@ -43,13 +43,7 @@
#include <glib.h>
#include <glib/gstdio.h>
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "common.h"
#include "log.h"
@ -94,10 +88,8 @@ static void _xmpp_file_logger(void* const userdata, const xmpp_log_level_t level
static void _connection_handler(xmpp_conn_t* const xmpp_conn, const xmpp_conn_event_t status, const int error,
xmpp_stream_error_t* const stream_error, void* const userdata);
#ifdef HAVE_LIBMESODE
TLSCertificate* _xmppcert_to_profcert(xmpp_tlscert_t* xmpptlscert);
static int _connection_certfail_cb(xmpp_tlscert_t* xmpptlscert, const char* const errormsg);
#endif
TLSCertificate* _xmppcert_to_profcert(const xmpp_tlscert_t* xmpptlscert);
static int _connection_certfail_cb(const xmpp_tlscert_t* xmpptlscert, const char* errormsg);
static void _random_bytes_init(void);
static void _random_bytes_close(void);
@ -220,28 +212,20 @@ connection_connect(const char* const jid, const char* const passwd, const char*
#undef LOG_FLAG_IF_SET
}
#ifdef HAVE_LIBMESODE
char* cert_path = prefs_get_tls_certpath();
if (cert_path) {
xmpp_conn_tlscert_path(conn.xmpp_conn, cert_path);
xmpp_conn_set_capath(conn.xmpp_conn, cert_path);
free(cert_path);
}
xmpp_conn_set_certfail_handler(conn.xmpp_conn, _connection_certfail_cb);
int connect_status = xmpp_connect_client(
conn.xmpp_conn,
altdomain,
port,
_connection_certfail_cb,
_connection_handler,
conn.xmpp_ctx);
#else
int connect_status = xmpp_connect_client(
conn.xmpp_conn,
altdomain,
port,
_connection_handler,
conn.xmpp_ctx);
#endif
if (connect_status == 0) {
conn.conn_status = JABBER_CONNECTING;
@ -555,28 +539,20 @@ connection_register(const char* const altdomain, int port, const char* const tls
reg->username = strdup(username);
reg->password = strdup(password);
#ifdef HAVE_LIBMESODE
char* cert_path = prefs_get_tls_certpath();
if (cert_path) {
xmpp_conn_tlscert_path(conn.xmpp_conn, cert_path);
xmpp_conn_set_capath(conn.xmpp_conn, cert_path);
free(cert_path);
}
xmpp_conn_set_certfail_handler(conn.xmpp_conn, _connection_certfail_cb);
int connect_status = xmpp_connect_raw(
conn.xmpp_conn,
altdomain,
port,
_connection_certfail_cb,
_register_handler,
reg);
#else
int connect_status = xmpp_connect_raw(
conn.xmpp_conn,
altdomain,
port,
_register_handler,
reg);
#endif
if (connect_status == 0) {
conn.conn_status = JABBER_RAW_CONNECTING;
@ -645,17 +621,15 @@ connection_clear_data(void)
}
}
#ifdef HAVE_LIBMESODE
TLSCertificate*
connection_get_tls_peer_cert(void)
{
xmpp_tlscert_t* xmpptlscert = xmpp_conn_tls_peer_cert(conn.xmpp_conn);
xmpp_tlscert_t* xmpptlscert = xmpp_conn_get_peer_cert(conn.xmpp_conn);
TLSCertificate* cert = _xmppcert_to_profcert(xmpptlscert);
xmpp_conn_free_tlscert(conn.xmpp_ctx, xmpptlscert);
xmpp_tlscert_free(xmpptlscert);
return cert;
}
#endif
gboolean
connection_is_secured(void)
@ -971,9 +945,8 @@ _connection_handler(xmpp_conn_t* const xmpp_conn, const xmpp_conn_event_t status
}
}
#ifdef HAVE_LIBMESODE
static int
_connection_certfail_cb(xmpp_tlscert_t* xmpptlscert, const char* const errormsg)
_connection_certfail_cb(const xmpp_tlscert_t* xmpptlscert, const char* errormsg)
{
TLSCertificate* cert = _xmppcert_to_profcert(xmpptlscert);
@ -984,20 +957,21 @@ _connection_certfail_cb(xmpp_tlscert_t* xmpptlscert, const char* const errormsg)
}
TLSCertificate*
_xmppcert_to_profcert(xmpp_tlscert_t* xmpptlscert)
_xmppcert_to_profcert(const xmpp_tlscert_t* xmpptlscert)
{
int version = (int)strtol(
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_VERSION), NULL, 10);
return tlscerts_new(
xmpp_conn_tlscert_fingerprint(xmpptlscert),
xmpp_conn_tlscert_version(xmpptlscert),
xmpp_conn_tlscert_serialnumber(xmpptlscert),
xmpp_conn_tlscert_subjectname(xmpptlscert),
xmpp_conn_tlscert_issuername(xmpptlscert),
xmpp_conn_tlscert_notbefore(xmpptlscert),
xmpp_conn_tlscert_notafter(xmpptlscert),
xmpp_conn_tlscert_key_algorithm(xmpptlscert),
xmpp_conn_tlscert_signature_algorithm(xmpptlscert));
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_FINGERPRINT_SHA1),
version,
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_SERIALNUMBER),
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_SUBJECT),
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_ISSUER),
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_NOTBEFORE),
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_NOTAFTER),
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_KEYALG),
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_SIGALG));
}
#endif
static xmpp_log_t*
_xmpp_get_file_logger(void)

View File

@ -38,13 +38,7 @@
#include <string.h>
#include <stdlib.h>
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include <glib.h>

View File

@ -36,13 +36,7 @@
#ifndef XMPP_FORM_H
#define XMPP_FORM_H
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "xmpp/xmpp.h"

View File

@ -44,13 +44,7 @@
#include <stdio.h>
#include <glib.h>
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "profanity.h"
#include "log.h"

View File

@ -39,13 +39,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "profanity.h"
#include "log.h"

View File

@ -42,13 +42,7 @@
#include <glib.h>
#include <glib/gprintf.h>
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "profanity.h"
#include "log.h"

View File

@ -41,13 +41,7 @@
#include <glib.h>
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "profanity.h"
#include "log.h"

View File

@ -48,13 +48,7 @@
#include <glib.h>
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "common.h"
#include "log.h"

View File

@ -38,13 +38,7 @@
#include "config.h"
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include <xmpp/xmpp.h>

View File

@ -40,13 +40,7 @@
#include "config.h"
#ifdef HAVE_LIBMESODE
#include <mesode.h>
#endif
#ifdef HAVE_LIBSTROPHE
#include <strophe.h>
#endif
#include "config/accounts.h"
#include "config/tlscerts.h"
@ -199,9 +193,7 @@ char* connection_get_barejid(void);
char* connection_get_user(void);
char* connection_create_uuid(void);
void connection_free_uuid(char* uuid);
#ifdef HAVE_LIBMESODE
TLSCertificate* connection_get_tls_peer_cert(void);
#endif
gboolean connection_is_secured(void);
gboolean connection_send_stanza(const char* const stanza);
GList* connection_get_available_resources(void);