Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
oheil committed Aug 27, 2020
1 parent 4f7d4d9 commit 9e30dec
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions experiment.js
Expand Up @@ -7,33 +7,37 @@ var exp_logout = class extends ExtensionCommon.ExtensionAPI {
exp_logout: {
async exp_logout(identities) {
if( identities != null && identities.length > 0 ) {
var acctMgr = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
var accounts = acctMgr.accounts;
for (var i = 0; i < accounts.length; i++) {
var account = accounts[i];
if( account != null && account.identities != null && account.incomingServer != null ) {
for (var j = 0; j < account.identities.length; j++) {
var id = account.identities[j];
if( id != null ) {
for (var k = 0; k < identities.length; k++) {
var id2logout = identities[k].id;
if( id2logout == id.key ) {
account.incomingServer.forgetPassword();
account.incomingServer.forgetSessionPassword();
account.incomingServer.closeCachedConnections();
var smtpService=Components.classes['@mozilla.org/messengercompose/smtp;1'].getService(Components.interfaces.nsISmtpService);
if( smtpService != null ) {
var smtpServer=smtpService.getServerByKey(id.smtpServerKey);
if( smtpServer != null ) {
smtpServer.forgetPassword();
var acctMgr = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
if( acctMgr != null ) {
var accounts = acctMgr.accounts;
if( accounts != null && accounts.length > 0 ) {
for (var i = 0; i < accounts.length; i++) {
var account = accounts[i];
if( account != null && account.identities != null && account.incomingServer != null ) {
for (var j = 0; j < account.identities.length; j++) {
var id = account.identities[j];
if( id != null ) {
for (var k = 0; k < identities.length; k++) {
var id2logout = identities[k].id;
if( id2logout == id.key ) {
account.incomingServer.forgetPassword();
account.incomingServer.forgetSessionPassword();
account.incomingServer.closeCachedConnections();
var smtpService=Components.classes['@mozilla.org/messengercompose/smtp;1'].getService(Components.interfaces.nsISmtpService);
if( smtpService != null ) {
var smtpServer=smtpService.getServerByKey(id.smtpServerKey);
if( smtpServer != null ) {
smtpServer.forgetPassword();
}
}
}
}
}
}
}
}
}
}
}
}
}
}
Expand Down

0 comments on commit 9e30dec

Please sign in to comment.