Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GUri instead of libsoup-2.4 and use webkit2gtk-4.1 #745

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci-debian-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ jobs:
- image: 'debian:bullseye'
env:
WEBKITGTK_VERSION: '4.0'
- image: 'ubuntu:focal'
env:
WEBKITGTK_VERSION: '4.0'
- image: 'debian:sid'
env:
WEBKITGTK_VERSION: '4.1'
Expand Down
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ endif()

pkg_check_modules (GTKMM3 REQUIRED gtkmm-3.0>=3.10)
pkg_check_modules (GLIBMM2 REQUIRED glibmm-2.4)
pkg_check_modules (WEBKIT2GTK REQUIRED webkit2gtk-4.0>=2.22)
pkg_check_modules (WEBKIT2GTK webkit2gtk-4.1)
if (NOT WEBKIT2GTK_FOUND)
pkg_check_modules (WEBKIT2GTK REQUIRED webkit2gtk-4.0>=2.22)
endif ()
pkg_check_modules (SASS REQUIRED libsass)
pkg_check_modules (GIOMM2 REQUIRED giomm-2.4)
pkg_check_modules (GIOUNIX REQUIRED gio-unix-2.0)
pkg_check_modules (LIBSOUP REQUIRED libsoup-2.4)
pkg_check_modules (GIOUNIX REQUIRED gio-unix-2.0>=2.66)

string (REGEX REPLACE "([0-9]+\.[0-9]+)\.[0-9]+" "\\1" GMIME_MAJOR_MINOR ${Notmuch_GMIME_VERSION})
pkg_check_modules (GMIME REQUIRED gmime-${GMIME_MAJOR_MINOR}>=${Notmuch_GMIME_VERSION})
Expand Down Expand Up @@ -154,7 +156,6 @@ include_directories (
${GLIBMM2_INCLUDE_DIRS}
${GIOMM2_INCLUDE_DIRS}
${GIOUNIX_INCLUDE_DIRS}
${LIBSOUP_INCLUDE_DIRS}
${GMIME_INCLUDE_DIRS}
${WEBKIT2GTK_INCLUDE_DIRS}
${VTE2_INCLUDE_DIRS}
Expand All @@ -169,7 +170,6 @@ add_compile_options (
${GLIBMM2_CFLAGS}
${GIOMM2_CFLAGS}
${GIOUNIX_CFLAGS}
${LIBSOUP_CFLAGS}
${GMIME_CFLAGS}
${WEBKIT2GTK_CFLAGS}
${VTE2_CFLAGS}
Expand Down Expand Up @@ -339,7 +339,6 @@ target_link_libraries (
${GLIBMM2_LDFLAGS}
${GIOMM2_LDFLAGS}
${GIOUNIX_LDFLAGS}
${LIBSOUP_LDFLAGS}
${GMIME_LDFLAGS}
${VTE2_LDFLAGS}
${SASS_LDFLAGS}
Expand Down
21 changes: 11 additions & 10 deletions src/astroid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# include <gtkmm.h>
# include <gtkmm/window.h>

# include <glib.h>

/* program options */
# include <boost/program_options.hpp>
# include <boost/filesystem.hpp>
Expand Down Expand Up @@ -53,8 +55,6 @@
# include <gmime/gmime.h>
# include <utils/gmime/gmime-compat.h>

# include <libsoup/soup.h>

using namespace std;
using namespace boost::filesystem;

Expand Down Expand Up @@ -550,25 +550,26 @@ namespace Astroid {

MainWindow * mw = (MainWindow*) get_windows ()[0];

SoupURI *uri = soup_uri_new(url.c_str());
GUriFlags guriflags = (GUriFlags)(G_URI_FLAGS_ENCODED_PATH | G_URI_FLAGS_ENCODED_QUERY | G_URI_FLAGS_ENCODED_FRAGMENT | G_URI_FLAGS_PARSE_RELAXED);
GUri *guri = g_uri_parse (url.c_str(), guriflags, NULL);

if (SOUP_URI_IS_VALID(uri)) {
if (guri) {
/* we got an mailto url */
ustring from, to, cc, bcc, subject, body;

to = soup_uri_decode (soup_uri_get_path (uri));
to = g_uri_unescape_string (g_uri_get_path (guri), NULL);

const char * soup_query = soup_uri_get_query (uri);
if (soup_query) {
std::istringstream query_string (soup_query);
const char * uri_query = g_uri_get_query (guri);
if (uri_query) {
std::istringstream query_string (uri_query);
std::string keyval;
while (std::getline(query_string, keyval, '&')) {
ustring::size_type pos = keyval.find ("=");

ustring key = keyval.substr (0, pos);
key = key.lowercase ();

ustring val = soup_uri_decode (keyval.substr (pos+1).c_str());
ustring val = g_uri_unescape_string (keyval.substr (pos+1).c_str(), NULL);

if (key == "from") {
from = ustring (val);
Expand All @@ -591,7 +592,7 @@ namespace Astroid {
mw->add_mode (new EditMessage (mw, url));
}

soup_uri_free (uri);
g_uri_unref (guri);
}

int Astroid::hint_level () {
Expand Down