GMail: Add ability to set a custom host/port/ssl etc.

The GMail repository added in 81b86fb has the restriction that you
can't override the host/port/ssl etc. There's no good reason for this,
and I'd like to use some of the defaults while connecting to GMail via
an stunnel, i.e.:

    $ grep -v -e ^# -e ^$ .stunnel.work-gmail-imap
    foreground = yes
    debug = info
    pid =
    [work-imap-gmail-ssl-tunnel]
    client = yes
    accept = 127.0.0.1:1431
    connect = imap.gmail.com:993
    delay = yes

And then in my .offlineimaprc:

    type = Gmail
    remotehost = localhost
    remoteport = 1431
    ssl = no

While I was at it I also allowed overriding all the other previously
hardcoded options, e.g. the "oauth2_request_url" can now be overridden
to e.g. a local non-https proxy to sniff & debug the traffic going
over the wire.

This doesn't break any existing configuration, since we still use the
provided defaults. It just allows odd uses like my own to use this
repository while e.g. not having to supply "trashfolder", "spamfolder"
& "oauth2_request_url". While I'm at it document in the
offlineimap.conf that we're setting those options to defaults in this
repository.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2016-11-17 11:45:24 +01:00
committed by Nicolas Sebrecht
parent a5e32929b6
commit 7b59d6b3ae
2 changed files with 49 additions and 27 deletions

View File

@ -1242,12 +1242,18 @@ remoteuser = username
# Only "remoteuser" (or "remoteusereval" ) is mandatory. Default values for
# other parameters are OK, and you should not need fiddle with those.
#
# The Gmail repository will use hard-coded values for "remotehost",
# "remoteport", "tunnel" and "ssl". Any attempt to set those parameters will be
# silently ignored. For details, see
# The Gmail repository provides default values for "remotehost",
# "remoteport", "tunnel" and "ssl". For the defaults we use, see:
#
# http://mail.google.com/support/bin/answer.py?answer=78799&topic=12814
#
# In addition we provide defaults for "oauth2_request_url",
# "trashfolder" and "spamfolder".
#
# All of the defaults we provide can be overriden. E.g. you can
# override "remotehost"/"remoteport"/"ssl" if you'd like to connect to
# imap.gmail.com via a local stunnel instead of directly.
#
# To enable GMail labels synchronisation, set the option "synclabels" in the
# corresponding "Account" section.
#