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

Merge pull request #1426 from profanity-im/cleanup/newlibs

Cleanup/newlibs
This commit is contained in:
Michael Vetter 2020-10-09 09:41:34 +02:00 committed by GitHub
commit 315863575b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 19 additions and 64 deletions

View File

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

View File

@ -82,7 +82,8 @@ elif test "x$enable_python_plugins" != xno; then
rm -f Python.framework rm -f Python.framework
ln -s $PYTHON_FRAMEWORK Python.framework ]) ln -s $PYTHON_FRAMEWORK Python.framework ])
AC_CHECK_PROG(PYTHON_CONFIG_EXISTS, python-config, yes, no) AC_CHECK_PROG(PYTHON_CONFIG_EXISTS, python-config, yes, no)
if test "$PYTHON_CONFIG_EXISTS" = "yes"; then AC_CHECK_PROG(PYTHON3_CONFIG_EXISTS, python3-config, yes, no)
if test "$PYTHON_CONFIG_EXISTS" = "yes" || test "$PYTHON3_CONFIG_EXISTS" = "yes"; then
AX_PYTHON_DEVEL AX_PYTHON_DEVEL
AM_CONDITIONAL([BUILD_PYTHON_API], [true]) AM_CONDITIONAL([BUILD_PYTHON_API], [true])
AC_DEFINE([HAVE_PYTHON], [1], [Python support]) AC_DEFINE([HAVE_PYTHON], [1], [Python support])
@ -131,19 +132,11 @@ AS_IF([test "x$PTHREAD_CC" != x], [ CC="$PTHREAD_CC" ])
### Check for libmesode, fall back to libstrophe ### Check for libmesode, fall back to libstrophe
### TODO libmesode support will be removed in the future, rewrite this section ### TODO libmesode support will be removed in the future, rewrite this section
PKG_CHECK_MODULES([libmesode], [libmesode >= 0.9.3], 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])], [LIBS="$libmesode_LIBS $LIBS" CFLAGS="$CFLAGS $libmesode_CFLAGS" XMPP_LIB="libmesode" AC_DEFINE([HAVE_LIBMESODE], [1], [libmesode])],
[PKG_CHECK_MODULES([libstrophe], [libstrophe >= 0.9.3], [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])], [LIBS="$libstrophe_LIBS $LIBS" CFLAGS="$CFLAGS $libstrophe_CFLAGS" XMPP_LIB="libstrophe" AC_DEFINE([HAVE_LIBSTROPHE], [1], [libstrophe])],
[XMPP_LIB=""])]) [XMPP_LIB=""])])
if test "x$XMPP_LIB" = x; then
PKG_CHECK_MODULES([libmesode], [libmesode >= 0.9.2],
[LIBS="$libmesode_LIBS $LIBS" CFLAGS="$CFLAGS $libmesode_CFLAGS" XMPP_LIB="libmesode" AC_DEFINE([HAVE_LIBMESODE], [1], [libmesode])],
[PKG_CHECK_MODULES([libstrophe], [libstrophe >= 0.9.2],
[LIBS="$libstrophe_LIBS $LIBS" CFLAGS="$CFLAGS $libstrophe_CFLAGS" XMPP_LIB="libstrophe" AC_DEFINE([HAVE_LIBSTROPHE], [1], [libstrophe])],
[AC_MSG_ERROR([libstrophe-0.9.2 or later is required for profanity])])])
AC_DEFINE([HAVE_LIBSTROPHE_LT_0_9_3], [1], [Old libstrophe is present])
fi
AC_MSG_CHECKING([whether ${XMPP_LIB} works]) AC_MSG_CHECKING([whether ${XMPP_LIB} works])
AC_LINK_IFELSE([AC_LANG_SOURCE([[ AC_LINK_IFELSE([AC_LANG_SOURCE([[
@ -194,8 +187,8 @@ AS_IF([test "x$ncurses_cv_wget_wch" != xyes],
[AC_MSG_ERROR([ncurses does not support wide characters])]) [AC_MSG_ERROR([ncurses does not support wide characters])])
### Check for glib libraries ### Check for glib libraries
PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.56.0], [], PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.62.0], [],
[AC_MSG_ERROR([glib 2.56.0 or higher is required for profanity])]) [AC_MSG_ERROR([glib 2.62.0 or higher is required for profanity])])
PKG_CHECK_MODULES([gio], [gio-2.0], [], PKG_CHECK_MODULES([gio], [gio-2.0], [],
[AC_MSG_ERROR([libgio-2.0 from glib-2.0 is required for profanity])]) [AC_MSG_ERROR([libgio-2.0 from glib-2.0 is required for profanity])])

View File

@ -316,15 +316,9 @@ _add_to_db(ProfMessage* message, char* type, const Jid* const from_jid, const Ji
gchar* date_fmt; gchar* date_fmt;
if (message->timestamp) { if (message->timestamp) {
// g_date_time_format_iso8601() is only availble from glib 2.62 on. date_fmt = g_date_time_format_iso8601(message->timestamp);
// To still support Debian buster lets use g_date_time_format() for now.
//date_fmt = g_date_time_format_iso8601(message->timestamp);
date_fmt = g_date_time_format(message->timestamp, "%FT%T%:::z");
} else { } else {
// g_date_time_format_iso8601() is only availble from glib 2.62 on. date_fmt = g_date_time_format_iso8601(g_date_time_new_now_local());
// To still support Debian buster lets use g_date_time_format() for now.
//date_fmt = g_date_time_format_iso8601(g_date_time_new_now_local());
date_fmt = g_date_time_format(g_date_time_new_now_local(), "%FT%T%:::z");
} }
const char* enc = _get_message_enc_str(message->enc); const char* enc = _get_message_enc_str(message->enc);

View File

@ -210,7 +210,7 @@ _avatar_request_item_result_handler(xmpp_stanza_t* const stanza, void* const use
return 1; return 1;
} }
xmpp_stanza_t* st_data = stanza_get_child_by_name_and_ns(item, "data", STANZA_NS_USER_AVATAR_DATA); xmpp_stanza_t* st_data = xmpp_stanza_get_child_by_name_and_ns(item, "data", STANZA_NS_USER_AVATAR_DATA);
if (!st_data) { if (!st_data) {
return 1; return 1;
} }

View File

@ -308,7 +308,7 @@ _bookmark_result_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
// we save minimize, which is not standard, so that we don't remove it if it was set by gajim // we save minimize, which is not standard, so that we don't remove it if it was set by gajim
int minimize = 0; int minimize = 0;
xmpp_stanza_t* minimize_st = stanza_get_child_by_name_and_ns(child, STANZA_NAME_MINIMIZE, STANZA_NS_EXT_GAJIM_BOOKMARKS); xmpp_stanza_t* minimize_st = xmpp_stanza_get_child_by_name_and_ns(child, STANZA_NAME_MINIMIZE, STANZA_NS_EXT_GAJIM_BOOKMARKS);
if (minimize_st) { if (minimize_st) {
char* min_str = xmpp_stanza_get_text(minimize_st); char* min_str = xmpp_stanza_get_text(minimize_st);
if (strcmp(min_str, "true") == 0) { if (strcmp(min_str, "true") == 0) {

View File

@ -193,13 +193,7 @@ connection_connect(const char* const jid, const char* const passwd, const char*
} }
if (auth_policy && (g_strcmp0(auth_policy, "legacy") == 0)) { if (auth_policy && (g_strcmp0(auth_policy, "legacy") == 0)) {
#ifdef HAVE_LIBSTROPHE_LT_0_9_3
log_warning("Legacy authentication is requested, but it hasn't been "
"built. Update libstrophe and rebuild Profanity.");
cons_show("Legacy authentication is requested, but it hasn't been built.");
#else
flags |= XMPP_CONN_FLAG_LEGACY_AUTH; flags |= XMPP_CONN_FLAG_LEGACY_AUTH;
#endif /* HAVE_LIBSTROPHE_LT_0_9_3 */
} }
xmpp_conn_set_flags(conn.xmpp_conn, flags); xmpp_conn_set_flags(conn.xmpp_conn, flags);
@ -215,9 +209,7 @@ connection_connect(const char* const jid, const char* const passwd, const char*
LOG_FLAG_IF_SET(XMPP_CONN_FLAG_TRUST_TLS); LOG_FLAG_IF_SET(XMPP_CONN_FLAG_TRUST_TLS);
LOG_FLAG_IF_SET(XMPP_CONN_FLAG_DISABLE_TLS); LOG_FLAG_IF_SET(XMPP_CONN_FLAG_DISABLE_TLS);
LOG_FLAG_IF_SET(XMPP_CONN_FLAG_LEGACY_SSL); LOG_FLAG_IF_SET(XMPP_CONN_FLAG_LEGACY_SSL);
#ifndef HAVE_LIBSTROPHE_LT_0_9_3
LOG_FLAG_IF_SET(XMPP_CONN_FLAG_LEGACY_AUTH); LOG_FLAG_IF_SET(XMPP_CONN_FLAG_LEGACY_AUTH);
#endif /* HAVE_LIBSTROPHE_LT_0_9_3 */
#undef LOG_FLAG_IF_SET #undef LOG_FLAG_IF_SET
} }

View File

@ -947,7 +947,7 @@ _handle_groupchat(xmpp_stanza_t* const stanza)
const char* id = xmpp_stanza_get_id(stanza); const char* id = xmpp_stanza_get_id(stanza);
char* originid = NULL; char* originid = NULL;
xmpp_stanza_t* origin = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_ORIGIN_ID, STANZA_NS_STABLE_ID); xmpp_stanza_t* origin = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_ORIGIN_ID, STANZA_NS_STABLE_ID);
if (origin) { if (origin) {
originid = (char*)xmpp_stanza_get_attribute(origin, STANZA_ATTR_ID); originid = (char*)xmpp_stanza_get_attribute(origin, STANZA_ATTR_ID);
} }
@ -1282,7 +1282,7 @@ _handle_chat(xmpp_stanza_t* const stanza, gboolean is_mam, gboolean is_carbon, c
// live messages use XEP-0359 <stanza-id> // live messages use XEP-0359 <stanza-id>
// TODO: add to muc too // TODO: add to muc too
char* stanzaid = NULL; char* stanzaid = NULL;
xmpp_stanza_t* stanzaidst = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_STANZA_ID, STANZA_NS_STABLE_ID); xmpp_stanza_t* stanzaidst = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_STANZA_ID, STANZA_NS_STABLE_ID);
if (stanzaidst) { if (stanzaidst) {
stanzaid = (char*)xmpp_stanza_get_attribute(stanzaidst, STANZA_ATTR_ID); stanzaid = (char*)xmpp_stanza_get_attribute(stanzaidst, STANZA_ATTR_ID);
if (stanzaid) { if (stanzaid) {
@ -1365,11 +1365,9 @@ _handle_ox_chat(xmpp_stanza_t* const stanza, ProfMessage* message, gboolean is_m
message->enc = PROF_MSG_ENC_OX; message->enc = PROF_MSG_ENC_OX;
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
xmpp_stanza_t* ox = stanza_get_child_by_name_and_ns(stanza, "openpgp", STANZA_NS_OPENPGP_0); xmpp_stanza_t* ox = xmpp_stanza_get_child_by_name_and_ns(stanza, "openpgp", STANZA_NS_OPENPGP_0);
message->plain = p_ox_gpg_decrypt(xmpp_stanza_get_text(ox)); message->plain = p_ox_gpg_decrypt(xmpp_stanza_get_text(ox));
// Implementation for libstrophe 0.10.
/*
xmpp_stanza_t *x = xmpp_stanza_new_from_string(connection_get_ctx(), message->plain); xmpp_stanza_t *x = xmpp_stanza_new_from_string(connection_get_ctx(), message->plain);
xmpp_stanza_t *p = xmpp_stanza_get_child_by_name(x, "payload"); xmpp_stanza_t *p = xmpp_stanza_get_child_by_name(x, "payload");
xmpp_stanza_t *b = xmpp_stanza_get_child_by_name(p, "body"); xmpp_stanza_t *b = xmpp_stanza_get_child_by_name(p, "body");
@ -1378,7 +1376,6 @@ _handle_ox_chat(xmpp_stanza_t* const stanza, ProfMessage* message, gboolean is_m
message->plain = xmpp_stanza_get_text(stanza); message->plain = xmpp_stanza_get_text(stanza);
} }
message->encrypted = xmpp_stanza_get_text(ox); message->encrypted = xmpp_stanza_get_text(ox);
*/
if (message->plain == NULL) { if (message->plain == NULL) {
message->plain = xmpp_stanza_get_text(stanza); message->plain = xmpp_stanza_get_text(stanza);
@ -1390,7 +1387,7 @@ _handle_ox_chat(xmpp_stanza_t* const stanza, ProfMessage* message, gboolean is_m
static gboolean static gboolean
_handle_mam(xmpp_stanza_t* const stanza) _handle_mam(xmpp_stanza_t* const stanza)
{ {
xmpp_stanza_t* result = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_RESULT, STANZA_NS_MAM2); xmpp_stanza_t* result = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_RESULT, STANZA_NS_MAM2);
if (!result) { if (!result) {
return FALSE; return FALSE;
} }

View File

@ -269,7 +269,7 @@ _ox_metadata_result(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void*
return FALSE; return FALSE;
} }
// pubsub // pubsub
xmpp_stanza_t* pubsub = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_PUBSUB, XMPP_FEATURE_PUBSUB); xmpp_stanza_t* pubsub = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_PUBSUB, XMPP_FEATURE_PUBSUB);
if (!pubsub) { if (!pubsub) {
cons_show("OX: Error: No pubsub"); cons_show("OX: Error: No pubsub");
return FALSE; return FALSE;
@ -287,7 +287,7 @@ _ox_metadata_result(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void*
return FALSE; return FALSE;
} }
xmpp_stanza_t* publickeyslist = stanza_get_child_by_name_and_ns(item, STANZA_NAME_PUBLIC_KEYS_LIST, STANZA_NS_OPENPGP_0); xmpp_stanza_t* publickeyslist = xmpp_stanza_get_child_by_name_and_ns(item, STANZA_NAME_PUBLIC_KEYS_LIST, STANZA_NS_OPENPGP_0);
if (!publickeyslist) { if (!publickeyslist) {
cons_show("OX: Error: No publickeyslist"); cons_show("OX: Error: No publickeyslist");
return FALSE; return FALSE;
@ -392,7 +392,7 @@ _ox_public_key_result(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void
return FALSE; return FALSE;
} }
// pubsub // pubsub
xmpp_stanza_t* pubsub = stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_PUBSUB, XMPP_FEATURE_PUBSUB); xmpp_stanza_t* pubsub = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_PUBSUB, XMPP_FEATURE_PUBSUB);
if (!pubsub) { if (!pubsub) {
cons_show("Public Key import failed. Check log for details."); cons_show("Public Key import failed. Check log for details.");
log_error("OX: Public key request response failed: No <pubsub/>"); log_error("OX: Public key request response failed: No <pubsub/>");
@ -413,7 +413,7 @@ _ox_public_key_result(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void
return FALSE; return FALSE;
} }
xmpp_stanza_t* pubkey = stanza_get_child_by_name_and_ns(item, STANZA_NAME_PUPKEY, STANZA_NS_OPENPGP_0); xmpp_stanza_t* pubkey = xmpp_stanza_get_child_by_name_and_ns(item, STANZA_NAME_PUPKEY, STANZA_NS_OPENPGP_0);
if (!pubkey) { if (!pubkey) {
cons_show("Public Key import failed. Check log for details."); cons_show("Public Key import failed. Check log for details.");
log_error("OX: Public key request response failed: No <pubkey/>"); log_error("OX: Public key request response failed: No <pubkey/>");

View File

@ -2574,26 +2574,6 @@ _stanza_create_sha1_hash(char* str)
return b64; return b64;
} }
xmpp_stanza_t*
stanza_get_child_by_name_and_ns(xmpp_stanza_t* const stanza, const char* const name, const char* const ns)
{
xmpp_stanza_t* child;
const char* child_ns;
const char* child_name;
for (child = xmpp_stanza_get_children(stanza); child; child = xmpp_stanza_get_next(child)) {
child_name = xmpp_stanza_get_name(child);
if (child_name && strcmp(name, child_name) == 0) {
child_ns = xmpp_stanza_get_ns(child);
if (child_ns && strcmp(ns, child_ns) == 0) {
break;
}
}
}
return child;
}
xmpp_stanza_t* xmpp_stanza_t*
stanza_create_avatar_retrieve_data_request(xmpp_ctx_t* ctx, const char* stanza_id, const char* const item_id, const char* const jid) stanza_create_avatar_retrieve_data_request(xmpp_ctx_t* ctx, const char* stanza_id, const char* const item_id, const char* const jid)
{ {

View File

@ -375,8 +375,6 @@ char* stanza_text_strdup(xmpp_stanza_t* stanza);
XMPPCaps* stanza_parse_caps(xmpp_stanza_t* const stanza); XMPPCaps* stanza_parse_caps(xmpp_stanza_t* const stanza);
void stanza_free_caps(XMPPCaps* caps); void stanza_free_caps(XMPPCaps* caps);
xmpp_stanza_t* stanza_get_child_by_name_and_ns(xmpp_stanza_t* const stanza, const char* const name, const char* const ns);
xmpp_stanza_t* stanza_create_avatar_retrieve_data_request(xmpp_ctx_t* ctx, const char* stanza_id, const char* const item_id, const char* const jid); xmpp_stanza_t* stanza_create_avatar_retrieve_data_request(xmpp_ctx_t* ctx, const char* stanza_id, const char* const item_id, const char* const jid);
xmpp_stanza_t* stanza_create_mam_iq(xmpp_ctx_t* ctx, const char* const jid, const char* const startdate); xmpp_stanza_t* stanza_create_mam_iq(xmpp_ctx_t* ctx, const char* const jid, const char* const startdate);