Add OAUTH2 to Geary.Credentials.Method.

This commit is contained in:
Michael James Gratton 2018-05-29 05:48:44 +02:00
parent 13c92c3f7e
commit 29731383ea

View file

@ -1,4 +1,6 @@
/* Copyright 2016 Software Freedom Conservancy Inc.
/*
* Copyright 2016 Software Freedom Conservancy Inc.
* Copyright 2018 Michael Gratton <mike@vee.net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
@ -30,14 +32,22 @@ public class Geary.Credentials : BaseObject, Gee.Hashable<Geary.Credentials> {
* Authentication methods supported by the Engine.
*/
public enum Method {
/** Password-based authentication, such as SASL PLAIN. */
PASSWORD;
PASSWORD,
/** OAuth2-based authentication. */
OAUTH2;
public string to_string() {
switch (this) {
case PASSWORD:
return "password";
case OAUTH2:
return "oauth2";
default:
assert_not_reached();
}
@ -48,6 +58,9 @@ public class Geary.Credentials : BaseObject, Gee.Hashable<Geary.Credentials> {
case "password":
return PASSWORD;
case "oauth2":
return OAUTH2;
default:
throw new KeyFileError.INVALID_VALUE(
"Unknown credentials method type: %s", str