~ubuntu-branches/ubuntu/vivid/geary/vivid

« back to all changes in this revision

Viewing changes to src/engine/api/geary-engine.vala

  • Committer: Package Import Robot
  • Author(s): Jackson Doak
  • Date: 2014-09-10 07:13:14 UTC
  • mfrom: (1.1.15) (1.2.9 sid)
  • Revision ID: package-import@ubuntu.com-20140910071314-oqclz8m8fbnzv1nd
Tags: 0.6.3-1ubuntu1
* Merge from debian. Remaining changes:
  - debian/control: Add build-depends on libmessaging-menu-dev and
    libunity-dev for Unity integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
     * Fired when an account is deleted.
81
81
     */
82
82
    public signal void account_removed(AccountInformation account);
83
 
 
 
83
    
 
84
    /**
 
85
     * Fired when an {@link Endpoint} associated with the {@link AccountInformation} reports
 
86
     * TLS certificate warnings during connection.
 
87
     *
 
88
     * This may be fired during normal operation or while validating the AccountInformation, in
 
89
     * which case there is no {@link Account} associated with it.
 
90
     */
 
91
    public signal void untrusted_host(Geary.AccountInformation account_information,
 
92
        Endpoint endpoint, Endpoint.SecurityType security, TlsConnection cx, Service service);
 
93
    
84
94
    private Engine() {
85
95
    }
86
96
    
101
111
        
102
112
        is_initialized = true;
103
113
        
 
114
        AccountInformation.init();
104
115
        Logging.init();
105
116
        RFC822.init();
106
117
        ImapEngine.init();
239
250
        if (!options.is_all_set(ValidationOption.CHECK_CONNECTIONS))
240
251
            return error_code;
241
252
        
 
253
        account.untrusted_host.connect(on_untrusted_host);
 
254
        
242
255
        // validate IMAP, which requires logging in and establishing an AUTHORIZED cx state
243
256
        Geary.Imap.ClientSession? imap_session = new Imap.ClientSession(account.get_imap_endpoint());
244
257
        try {
286
299
        }
287
300
        
288
301
        try {
289
 
            yield smtp_session.logout_async(cancellable);
 
302
            yield smtp_session.logout_async(true, cancellable);
290
303
        } catch (Error err) {
291
304
            // ignored
292
305
        } finally {
293
306
            smtp_session = null;
294
307
        }
295
308
        
 
309
        account.untrusted_host.disconnect(on_untrusted_host);
 
310
        
296
311
        return error_code;
297
312
    }
298
313
    
352
367
        accounts.set(account.email, account);
353
368
 
354
369
        if (!already_added) {
 
370
            account.untrusted_host.connect(on_untrusted_host);
 
371
            
355
372
            if (created)
356
373
                account_added(account);
 
374
            
357
375
            account_available(account);
358
376
        }
359
377
    }
372
390
        }
373
391
        
374
392
        if (accounts.unset(account.email)) {
 
393
            account.untrusted_host.disconnect(on_untrusted_host);
 
394
            
375
395
            // Removal *MUST* be done in the following order:
376
396
            // 1. Send the account-unavailable signal.
377
397
            account_unavailable(account);
386
406
            account_instances.unset(account.email);
387
407
        }
388
408
    }
 
409
    
 
410
    private void on_untrusted_host(AccountInformation account_information, Endpoint endpoint,
 
411
        Endpoint.SecurityType security, TlsConnection cx, Service service) {
 
412
        untrusted_host(account_information, endpoint, security, cx, service);
 
413
    }
389
414
}
390
415