diff options
author | Michael Vetter <jubalh@iodoru.org> | 2023-03-13 09:18:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-13 09:18:18 +0100 |
commit | e5e8ff221a08939b43edf488fa2a3b8fe95169ea (patch) | |
tree | bab370288daa0ec39923f61697f9f82787246755 /src/xmpp/connection.c | |
parent | f618b9cc16c37aa832202340f2f4cf2b29348026 (diff) | |
parent | 2936b09a63728c9ac0c1e92786d37fec673da8d2 (diff) | |
download | profani-tty-e5e8ff221a08939b43edf488fa2a3b8fe95169ea.tar.gz |
Merge pull request #1796 from profanity-im/minor-improvements
Minor improvements
Diffstat (limited to 'src/xmpp/connection.c')
-rw-r--r-- | src/xmpp/connection.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 3165a18e..3eca29c4 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -847,8 +847,6 @@ connection_set_priority(const int priority) conn.priority = priority; } -#if defined(LIBXMPP_VERSION_MAJOR) && defined(LIBXMPP_VERSION_MINOR) \ - && ((LIBXMPP_VERSION_MAJOR > 0) || (LIBXMPP_VERSION_MINOR >= 12)) static xmpp_stanza_t* _get_soh_error(xmpp_stanza_t* error_stanza) { @@ -857,19 +855,6 @@ _get_soh_error(xmpp_stanza_t* error_stanza) XMPP_STANZA_NAME_IN_NS("see-other-host", STANZA_NS_XMPP_STREAMS), NULL); } -#else -static xmpp_stanza_t* -_get_soh_error(xmpp_stanza_t* error_stanza) -{ - const char* name = xmpp_stanza_get_name(error_stanza); - const char* ns = xmpp_stanza_get_ns(error_stanza); - if (!name || !ns || strcmp(name, "error") || strcmp(ns, STANZA_NS_STREAMS)) { - log_debug("_get_soh_error: could not find error stanza"); - return NULL; - } - return xmpp_stanza_get_child_by_name_and_ns(error_stanza, "see-other-host", STANZA_NS_XMPP_STREAMS); -} -#endif #if GLIB_CHECK_VERSION(2, 66, 0) static gboolean @@ -878,12 +863,8 @@ _split_url(const char* alturi, gchar** host, gint* port) /* Construct a valid URI with `schema://` as `g_uri_split_network()` * requires this to be there. */ - const char* xmpp = "xmpp://"; - char* xmpp_uri = _xmalloc(strlen(xmpp) + strlen(alturi) + 1, NULL); - memcpy(xmpp_uri, xmpp, strlen(xmpp)); - memcpy(xmpp_uri + strlen(xmpp), alturi, strlen(alturi) + 1); + auto_gchar gchar* xmpp_uri = g_strdup_printf("xmpp://%s", alturi); gboolean ret = g_uri_split_network(xmpp_uri, 0, NULL, host, port, NULL); - free(xmpp_uri); /* fix-up `port` as g_uri_split_network() sets port to `-1` if it's missing * in the passed-in URI, but libstrophe expects a "missing port" * to be passed as `0` (which then results in connecting to the standard port). |