I’m trying to use the Camel library from Evolution and I’m stuck with this error:
my code:
var mimepart = new Camel.MimePart();
mimepart.set_content("bla bla", "text/plain");
valac returns this error.
error: Argument 1: Cannot convert from `unowned string' to `unowned string[]?'
mimepart.set_content("bla bla", "text/plain");
^^^^^^^^^
I’m new to Vala, but if I understand it correctly string[] is an array of string. So I tried:
mimepart.set_content({"bla bla"}, "text/plain");
which only returns a warning, but also doesn’t work
warning: passing argument 2 of ‘camel_mime_part_set_content’ from incompatible pointer type [-Wincompatible-pointer-types]
camel_mime_part_set_content (mimepart, _tmp6_, 1, "text/plain");
^~~~~~
In file included from /usr/include/evolution-data-server/camel/camel-cipher-context.h:27,
from /usr/include/evolution-data-server/camel/camel.h:30,
from /home/pi/repos/miso/miso.vala.c:10:
/usr/include/evolution-data-server/camel/camel-mime-part.h:119:21: note: expected ‘const gchar *’ {aka ‘const char *’} but argument is of type ‘gchar **’ {aka ‘char **’}
const gchar *data,
~~~~~~~~~~~~~^~~~
What would be the correct way to create a MimeMessage / MimePart? I found an C example in the wiki, but it also uses a simple string:
text = "Hello NotZed,\nTalking to yourself again?\n\n NotZed\n";
camel_mime_part_set_content(part, text, strlen(text), "text/plain");