~hkdb/geary/disco

« back to all changes in this revision

Viewing changes to src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala

  • Committer: hkdb
  • Date: 2019-09-26 19:40:48 UTC
  • Revision ID: hkdb@3df.io-20190926194048-n0vggm3yfo8p1ubr
Tags: upstream-3.32.2-disco
ImportĀ upstreamĀ versionĀ 3.32.2-disco

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2016 Software Freedom Conservancy Inc.
 
3
 * Copyright 2019 Michael Gratton <mike@vee.net>
 
4
 *
 
5
 * This software is licensed under the GNU Lesser General Public License
 
6
 * (version 2.1 or later). See the COPYING file in this distribution.
 
7
 */
 
8
 
 
9
private class Geary.ImapEngine.YahooAccount : Geary.ImapEngine.GenericAccount {
 
10
 
 
11
 
 
12
    public static void setup_account(AccountInformation account) {
 
13
        // noop
 
14
    }
 
15
 
 
16
    public static void setup_service(ServiceInformation service) {
 
17
        switch (service.protocol) {
 
18
        case Protocol.IMAP:
 
19
            service.host = "imap.mail.yahoo.com";
 
20
            service.port = Imap.IMAP_TLS_PORT;
 
21
            service.transport_security = TlsNegotiationMethod.TRANSPORT;
 
22
            break;
 
23
 
 
24
        case Protocol.SMTP:
 
25
            service.host = "smtp.mail.yahoo.com";
 
26
            service.port = Smtp.SUBMISSION_TLS_PORT;
 
27
            service.transport_security = TlsNegotiationMethod.TRANSPORT;
 
28
            break;
 
29
        }
 
30
    }
 
31
 
 
32
 
 
33
    public YahooAccount(AccountInformation config,
 
34
                        ImapDB.Account local,
 
35
                        Endpoint incoming_remote,
 
36
                        Endpoint outgoing_remote) {
 
37
        base(config, local, incoming_remote, outgoing_remote);
 
38
    }
 
39
 
 
40
    protected override MinimalFolder new_folder(ImapDB.Folder local_folder) {
 
41
        FolderPath path = local_folder.get_path();
 
42
        SpecialFolderType type;
 
43
        if (Imap.MailboxSpecifier.folder_path_is_inbox(path)) {
 
44
            type = SpecialFolderType.INBOX;
 
45
        } else {
 
46
            // Despite Yahoo not advertising that it supports
 
47
            // SPECIAL-USE via its CAPABILITIES, it lists the
 
48
            // appropriate attributes in LIST results anyway, so we
 
49
            // can just consult that. :|
 
50
            type = local_folder.get_properties().attrs.get_special_folder_type();
 
51
            // There can be only one Inbox
 
52
            if (type == SpecialFolderType.INBOX) {
 
53
                type = SpecialFolderType.NONE;
 
54
            }
 
55
        }
 
56
 
 
57
        return new YahooFolder(this, local_folder, type);
 
58
    }
 
59
 
 
60
}