Commit graph

58 commits

Author SHA1 Message Date
Niels De Graef
6ce2373a75 Create a config.vapi for config.h
Currently, a lot of our build variables that are defined at
configuration time, are spread out across the code base, often declared
as `extern` which can break when moving around sections of the code
across files.

This commit introduces a "Config" namespace which basically maps to the
definitions in `config.h`, but allows us to properly access them too
from the Vala source code.

By doing so, it helps us to more explicitly see where we rely on a
build variable from this file (which should be obvious from the `Config'
namespace).

To make it ourselves a bit easier in Meson too, we can declare an
internal dependency, which helps ensure that we pull in the dependency
where needed.
2025-12-07 01:32:32 +01:00
Michael Gratton
2f81fdf146 build: Add minimal ICU VAPI for UBreakIterator 2021-01-19 20:49:01 +11:00
Michael Gratton
968bc1a9e8 ImapDb.SearchQuery: Use libstemmer for stemming
Instead of shipping our own forked stemmer via SQLite, add a dependency
on libstemmer and use that instead.
2020-10-14 20:05:12 +11:00
Oliver Giles
b167550cab libytnef: properly initialize struct
Call TNEFInitialize on the TNEFStruct before use to make sure
all fields are initialized to their default values. Since libytnef
2.0.0 zero-initialization is not sufficient.
2020-05-05 10:13:50 +12:00
Torben
c6be77ba85 Remove last occurences of GMime 2.6 2019-12-03 11:37:45 +01:00
Torben
6a34a6166f Remove custom gmime-2.6 bindings 2019-12-01 12:37:57 +01:00
Michael Gratton
ab77067d8a Fix RFC822.Header.get_header_names returning null names
The custom GMime VAPI assumed the call to get_iter() actually returned a
new iter, but it doesn't. Fix that, update Header class style, and add
tests.
2019-10-22 17:20:52 +11:00
Michael Gratton
6af84001f2 Fix another GMime custom binding abstract ctors
Silences compiler warnings produced by current vala head
2019-07-17 18:28:38 +10:00
Michael Gratton
f07c84adb3 Fix GMime custom binding abstract ctors
Silences compiler warnings produced by current vala head
2019-07-17 15:36:09 +10:00
Niels De Graef
3d1032db01 Migrated from libnotify to GLib notifications. bug 766133
Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>
2019-04-17 09:06:24 +10:00
Oliver Giles
18fcf0e18f TNEF (winmail.dat) parsing support via libytnef 2019-04-11 12:24:52 +03:00
Michael Gratton
68a985a76c Support building with Enchant 2.x
This adds support for Enchant 2 named "enchant" and Enchant 2 named
"enchant-2" (!)
2019-01-16 11:12:31 +11:00
Rico Tzschichholz
20cd9823a7 bindings: Drop custom javascriptcore-4.0 and webkit2gtk-4.0 vapi 2018-06-04 12:55:59 +02:00
Michael James Gratton
386f9864c7 Revert "Merge branch 'wip/ricotz/webkit'. Fixes Bug 788113."
This reverts commit 43341cd3e3, reversing
changes made to ffb4befdd8.

This is causing segfault in Geary.JS.to_string_released() when running
client tests, so reverting until a solution is found.
2018-05-19 13:57:58 +10:00
Rico Tzschichholz
f809febed3 Drop custom webkit2gtk bindings 2018-04-23 19:38:37 +02:00
Michael James Gratton
8a1906fa96 Ensure encoded mailbox addresses are decoded correctly.
Both RFC mailbox address names and mailboxes/local-names may by RFC 2047
be Quoted-Printable or Base64 encoded. This patch ensures these parts are
correctly decoded when parsing a RFC 822 message, so that they are
displayed to the user in human-readable form.

Part 2 of Mailsploit mitigation.

* src/engine/rfc822/rfc822-message.vala (Message): Since GMime.Message's
  convenience properties for accessing header values such as senders,
  recipients, etc. in string form are presented as human-readable, not
  RFC822 compliant strings, we can't re-parse them for use by this class
  when it is being constructed from a GMime-based source. Instead,
  iterate over all headers to get the raw values and parse those we are
  interested in instead. Add unit tests.

* src/engine/rfc822/rfc822-mailbox-address.vala (BaseObject): Add gmime
  constructor so we can handle construction and decoding from a GMime
  InternetAddressMailbox object in a consistent way. Ensure both names
  are decoded correctly, and mailboxes are decoded at all, from both
  GMime and IMAP sources. If a GMime source's address has no @-symbol,
  try to decode the whole thing first it in case the whole address is
  encoded. Add unit tests.

* src/engine/rfc822/rfc822-mailbox-addresses.vala (MailboxAddresses):
  Add append method and handle group addresses here instead of in Message
  to simplify updated Message implementation.

* src/engine/rfc822/rfc822-message-data.vala (MessageData): Add append
  method to simplify updated Message implementation.
2018-01-31 16:15:29 +10:30
Michael James Gratton
a0ff57c158 Remove --enabled-deprecated vala warnings, fix a bunch of them. 2018-01-15 16:17:11 +11:00
Michael James Gratton
a972236bb2 Update WebKit and JSC dependencies in Meson build.
* bindings/meson.build: Declare a dependency for JSC that includes both
  the lib, VAPI and appropriate build directory. Update WK dependencies
  to reflect the same that their pkg-config files currently do, sort.

* meson.build: Rename top-level JSC deps to make it clear what they are
  for.

* src/engine/meson.build: Depend on JSC rather than WK, sort deps.
2017-12-18 14:49:04 +11:00
Niels De Graef
01c13f726f Port build system to Meson. Bug 777044.
Some remarks:

* Note that Meson adds a hard dependency on Python 3.

* All dependencies and defines are now listed together.

* Some build files were put in their respective subdirectories, e.g. the Geary
  engine library will be built from the Meson file in `src/engine`.

* `--fatal-warnings` is no longer an explicit flag, as Meson provides
  `-Dwerror=true` for this.

* An explicit resource file needs to be used. The issue to support this from
  Meson itself can be found at https://github.com/mesonbuild/meson/issues/706 .

* The `gnome.yelp()` function parses a LINGUAS file so we no longer need to keep
  track of all languages in our build system.

* There are no Debian scripts defined in the meson.build files to keep them
  clean, but they can be kept as separate scripts in `build-aux`.

* Left out the `dist` target as there is now `ninja dist`

* `geary-docs` is disabled by default, as valadoc-0.38.3 returns errors.

https://bugzilla.gnome.org/show_bug.cgi?id=777044
2017-12-12 00:27:46 +01:00
Michael James Gratton
8c2a4fc2a5 Add licensing info for libunwind binding, based on convention. 2017-11-19 12:07:14 +11:00
Michael James Gratton
bcca75f5a8 Include a back trace in problem report technical details.
This adds a dependcy on libunwind for generating the back trace.

* src/CMakeLists.txt: Require libunwind-generic package and libunwind
  VAPI. Update docs and debian/control with new dependencies.

* src/engine/api/geary-problem-report.vala (ProblemReport): Generate a
  stack trace in the default constructor if an error is specified.

* src/client/components/main-window-info-bar.vala
  (MainWindowInfoBar::format_details): Include stack trafe from problem
  report in output if present.

* ui/main-window-info-bar.ui: Add a ScrolledWindow around the TextView
  since the details could now be quite large.

* bindings/vapi/libunwind.vapi: Add bindings for libunwind courtesy
  Guillaume Poirier-Morency, add Error enum.
2017-11-18 15:25:28 +11:00
Michael James Gratton
157a109e7f Remove custom libsecret VAPI in favour of the system-provided one.
This gives us access to the full libsecret API.

* bindings/vapi/libsecret-1.vapi: Deleted.

* src/client/application/secret-mediator.vala (Object): Use an internal
  binding to the missing SCHEMA_COMPAT_NETWORK constant.
2017-11-02 19:05:26 +11:00
Rico Tzschichholz
1d0aac1dfe Fix vala binding generation with webkit2gtk 2.17.4 2017-06-26 16:49:02 +02:00
Michael James Gratton
2b5f94da7d Reenable basic deceptive link highlighting.
* bindings/vapi/javascriptcore-4.0.vapi (Object::get_property): Fix
  return type.

* src/client/conversation-viewer/conversation-message.vala (GtkTemplate):
  Hook up to new deceptive_link_clicked signal, remove old DOM-based
  implementation.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Add new deceptive_link_clicked signal and
  DeceptiveText enum, listen for deceptiveLinkClicked JS message and fire
  signal when received.

* src/client/util/util-webkit.vala (WebKitUtil): Add to_object util function.

* src/engine/util/util-js.vala (Geary.JS): Add to_object and get_property
  util functions.

* ui/conversation-web-view.js (ConversationPageState) Listen for link
  clicks, check for deceptive text and send message if found. Add unit
  tests for deceptive text check.

* test/js/composer-page-state-test.vala: Move ::run_javascript to parent
  class so new ConversationPageStateTest class can use it, adapt call
  sites to different parent signature.
2017-02-01 00:41:44 +11:00
Michael James Gratton
503ca3b478 Update Javascript memory management a bit.
* bindings/vapi/javascriptcore-4.0.vapi: Don't pretend JS.String will
  be unreff'ed by vala, it wont. Add JS.GlobalContext.retain, in case it
  wants to be used.

* src/client/components/client-web-view.vala
  (ClientWebView::ClientWebView): JavascriptResult instances are unref'ed
  when unowned.
2017-02-01 00:41:43 +11:00
Michael James Gratton
772b874def Clean up JavaScriptCore VAPI, client and engine code.
* bindings/vapi/javascriptcore-4.0.vapi: Make JS objects match their JSC
  definitions: move JSValueFoo methods to JS.Value, etc. Update call
  sites.

* src/client/util/util-webkit.vala: Move WebKit-specific common methods
  from ClientWebView here. Update call sites.

* src/engine/util/util-js.vala: Move JSC-specific common methods from
  ClientWebView and ComposerPageStateTest here. Update call sites.

* src/client/web-process/web-process-extension.vala: Check for and handle
  exceptions when calling JS code.

* src/CMakeLists.txt: Add new source files, make WebKit VAPI generation
  and engine compilation depend on JSC.
2017-02-01 00:41:43 +11:00
Michael James Gratton
22de6b122e Fix JS error getting F=F text from ComposerWebView. Add JS unit tests.
* ui/composer-web-view.js (ComposerPageState::resolveNesting): Apply JS
  RegExp globally, to match default GLib RegEx behaviour.

* test/js/composer-page-state-test.vala: New tests covering generation of
  HTML and F=F text from JS ComposerPageState object.

* test/CMakeLists.txt: Add the new test.

* test/main.vala (main): Add a test suite for JS tests, add the new test
  to it.

* src/client/components/client-web-view.vala (ClientWebView): Add a
  reason to the JSError domain for when a JS exception is thrown.

* bindings/vapi/javascriptcore-4.0.vapi (JS::Context): Add JS.Type and
  some additional methods needed for the unit tests. Move most
  GlobalContext methods to Context so we can pass the lowest common
  demominator around.
2017-02-01 00:41:43 +11:00
Michael James Gratton
5b8c68f5fa Implement getting message selection for quoting and selection in WK2.
* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Remove has_selection method since we are
  using the signal to specify if a selection was found or not. Update
  call sites to use that.
  (ConversationWebView::get_selection_for_find,
  ConversationWebView::get_selection_for_quoting): Implement using calls
  to web process JS methods.

* src/client/application/geary-controller.vala
  (GearyController::create_reply_forward_widget): If we have a possible
  message view to quote from, handle constructing the compser widget
  asynchronously, when we know if we have a quote or not.

* src/client/conversation-viewer/conversation-viewer.vala:
  (ConversationViewer::on_find_mode_changed): Handle getting text
  selection for finds asynchonously.

* src/client/components/client-web-view.vala
  (ClientWebView::get_string_result): New helper for getting string
  values from JS calls.

* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail::get_selection_for_quoting,
  ConversationEmail::get_selection_for_find): Handxle errors when
  obtaining selections from a message view.

* src/client/conversation-viewer/conversation-message.vala: Remove
  methods that were simply passed through to the web view anyway. Update
  call sies.

* src/client/web-process/util-conversation.vala: Port all remaining
  functions to JS, remove.

* bindings/vapi/javascriptcore-4.0.vapi: Add methods needed to get
  strings out of WebKit.JavascriptResult instances.

* ui/conversation-web-view.js: Implement selection functions in JS, minor
  cleanup.
2017-02-01 00:41:43 +11:00
Michael James Gratton
8d13bf1922 Enable accessing javascriptcore objects from web extensions.
* src/CMakeLists.txt: Also generate a custom Also generate a custom
  webkit2gtk-web-extension-4.0 VAPI that re-includes javascriptcore
  objects, so they can be access from the web extension.

* bindings/metadata/WebKit2WebExtension-4.0-custom.vala,
  bindings/metadata/WebKit2WebExtension-4.0.metadata: Include in-tree
  metadata for web extension VAPI, update to all access to JS obejcts.

* bindings/vapi/javascriptcore-4.0.vapi: Add a bunch of useful additional
  objects and method.
2017-02-01 00:41:43 +11:00
Michael James Gratton
3a3b5d0bff Rename some JS methods to be more vala-esque. 2017-02-01 00:41:43 +11:00
Michael James Gratton
26fe139e97 Initial pass at getting the HTML document's height from the web process.
* bindings/vapi/javascriptcore-4.0.vapi: Add some methods to
  GlobalContext for accessing JSValues as ints.

* src/client/components/client-web-view.vala
  (ClientWebView): Hook up UserContentManager script messages handler and
  handler implementation for "preferredHeightChanged", update the new
  preferred_height prop on the class, and queue a resize. Hook those
  values up to the GTK allocation machinery.
  (ClientWebView::get_int_result): Convenience method for getting an int
  from a JavascriptResult.
  (ClientWebView::get_preferred_height): Report back values as reported
  by messages from the script handler.
  (ClientWebView::register_message_handler): Convenience method for
  registering script messages handlers.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Remove now-redundant GTK allocation machinery.

* ui/client-web-view.js: Post a message to preferredHeightChanged when
  the page is sorta-kinda loaded.
2017-02-01 00:41:43 +11:00
Michael James Gratton
f51f55cd78 Depend on javascriptcore, generate webkit2 VAPI that uses it.
This gives us a means of using JS objects returned by UserContentManager
script messages directly from Vala.

* bindings/metadata/WebKit2-4.0.metadata: Tweak standard webkit2 VAPI to
  re-include methods that return javascriptcore objects.

* bindings/vapi/javascriptcore-4.0.vapi: Copy generated VAPI file into
  the tree, customise it so that it actually works.

* src/CMakeLists.txt: Generate the custom webkit2 VAPI, depend on
  javascriptcore and include in-tree javascriptcore VAPI in the client
  build.

* bindings/metadata/JSCore-3.0.metadata: Remove obsolete file.
2017-02-01 00:41:43 +11:00
Michael James Gratton
48b91b56d0 Replace WebKitGtk and custom VAPI in build with WebKit2GTK.
Start of changes for Bug 728002.
2017-02-01 00:41:43 +11:00
Michael James Gratton
8c22ce6727 Fix warning/crash when libnotify enabled and server is not present. Bug 768911.
* src/client/notification/libnotify.vala (Libnotify): Allow for the
  server capabilities being null.
2016-07-18 22:13:32 +10:00
Michael James Gratton
f10f898ab0 Always use UTF-8 for encoding non-ASCII/ISO-8859-1 headers. Bug 753870.
While message bodies are always sent as UTF-8, non ASCII/ISO-8859-1
headers were being encoded using GMime's default heuristics. This
uses some less-well-supported charsets and causing some rendering
issues in other less tolerant client.

Since we assume UTF-8 support for the body, assume it for headers as
well.

* src/engine/rfc822/rfc822.vala (Geary.RFC822.init): Set GMime user
  charsets to UTF-8.

* bindings/vapi/gmime-2.6.vapi (GMime): Fix binding for
  g_mime_set_user_charsets.
2016-06-30 15:29:39 +10:00
Leonardo Robol
cae4b443c6 Added support to change the spell-checking language.
Bug 720335

* src/client/composer/spell-check-popover.vala
  Implemented a GtkPopover allowing the user to select a
  subset of the currently installed dictionaries for the spell
  checking in the composer widget.

* src/client/util/util-international-vala
  Added detection of installed dictionaries and proper
  translation of the available languages. This requires
  Enchant as an additional dependency.

* src/client/application/geary-config.vala
  Added keys spell-check-visible-languages and
  spell-check-languages in GSettings.
2016-06-09 15:36:39 +10:00
Michael James Gratton
13657a2237 Bump minimum WebKitGTK version to 2.4, remove bindings for older versions.
This is both the latest getting security updates, and the version in
Debian Jessie.
2016-05-20 16:29:28 +10:00
Adam Dingle
654e513f9c Transfer Yorba copyrights to Software Freedom Conservancy 2016-05-06 08:33:37 -04:00
Jim Nelson
29448cab65 Update copyright to 2015 2015-02-06 12:43:33 -08:00
Jim Nelson
695426c1cb Remove Unity bindings: Bug #713092 2014-10-09 14:06:22 -07:00
Jim Nelson
f1c75fc465 Patch major memory leak due to GMime bindings
Discovered a few binding problems while working on another issue,
in particular gmime_parser_construct_message()'s return object
not being freed, which can hold an entire message (attachments and
all) in memory.
2014-07-30 19:02:11 -07:00
Jim Nelson
0eb0a2d6e6 Some date-related fixes 2014-05-12 15:44:22 -07:00
Jim Nelson
dc1445d6f0 Update copyrights to 2014: Closes bgo#722381 2014-02-04 19:01:09 -08:00
Charles Lindsay
cf8679e9b7 Get rid of unused bindings
Closes: bgo #722376
2014-01-17 14:31:15 -08:00
Jim Nelson
7c7c4fec02 Fix memory leaks due to GMime bindings
Includes regen'd VAPI.
2014-01-06 17:59:10 -08:00
Jim Nelson
26982f9bc4 Compile with WebKitGTK 2.3.x: Closes bgno#720315
WebKitGTK 2.4 will introduce using GClosure to register
DOM.EventTarget listeners, but old API still available, so using
that for now.

This also introduces compiling WebKit-3.0.gir to a VAPI and using
that during compilation.  This means that .gir warnings won't
cause compilation errors (--fatal-warnings) and that we have a bit
more control over binding generation.  Closes bgno#720442.
2013-12-17 19:00:11 -08:00
Jim Nelson
258c84d335 Build against WebKitGTK 2.0.4: Closes #720290 2013-12-12 14:48:53 -08:00
Jim Nelson
e29a9c801a Convert all MIME handling to Engine classes: Closes #6530
We've had numerous bugs due to improper MIME comparisons and dealing
with Content-Type and Content-Disposition (or their lack of presence
in a message).  Now the Engine offers MIME classes that better deal
with these issues without exporting the GMime structures, which
are not as easy to manage and don't offer some of the things that
have bitten us in the past (such as case-insensitive comparisons).
2013-11-15 17:39:00 -08:00
Jim Nelson
eed221bf3a Can't bld w/ Vala 0.22.1 WebKitGTK 2.2.2: Closes #7694, Closes #7695
Two problems:

(a) Vala 0.22.1 fixes a binding change in libnotify
that has to be fixed but causes Geary to be unable to build on prior
versions of Vala.  libnotify.vapi added to solve this problem.

(b) New version of Vala appears to be more sensitive to detecting
problems in .gir files.  Using our .metadata file to paper over these
issues in WebKit-3.0.gir.
2013-11-15 16:53:18 -08:00
Jim Nelson
cfc472cfc8 Build with WebKitGTK 2.2.0: Closes #7023
Geary will autodetect which version of the library is installed
and select the appropriate .metadata file to use for bindings.
Still backwards-compatible with Geary 1.10 to 2.0.
2013-10-28 16:18:10 -07:00