Bug 1151473 - Part 1: Remove use of expression closure in chat/components/, chat/content/, and chat/modules/. r=aleth
This commit is contained in:
Родитель
e970173a30
Коммит
78bfbafb78
|
@ -22,11 +22,11 @@ const kPrefAccountFirstConnectionState = "firstConnectionState";
|
|||
const kPrefConvertOldPasswords = "messenger.accounts.convertOldPasswords";
|
||||
const kPrefAccountPassword = "password";
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "_", function()
|
||||
XPCOMUtils.defineLazyGetter(this, "_", () =>
|
||||
l10nHelper("chrome://chat/locale/accounts.properties")
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "_maxDebugMessages", function()
|
||||
XPCOMUtils.defineLazyGetter(this, "_maxDebugMessages", () =>
|
||||
Services.prefs.getIntPref("messenger.accounts.maxDebugMessages")
|
||||
);
|
||||
|
||||
|
@ -79,28 +79,28 @@ function UnknownProtocol(aPrplId)
|
|||
}
|
||||
UnknownProtocol.prototype = {
|
||||
__proto__: ClassInfo("prplIProtocol", "Unknown protocol"),
|
||||
get name() "",
|
||||
get normalizedName() this.name,
|
||||
get iconBaseURI() "chrome://chat/skin/prpl-unknown/",
|
||||
getOptions: function() EmptyEnumerator,
|
||||
getUsernameSplit: function() EmptyEnumerator,
|
||||
get usernameEmptyText() "",
|
||||
get name() { return ""; },
|
||||
get normalizedName() { return this.name; },
|
||||
get iconBaseURI() { return "chrome://chat/skin/prpl-unknown/"; },
|
||||
getOptions: function() { return EmptyEnumerator; },
|
||||
getUsernameSplit: function() { return EmptyEnumerator; },
|
||||
get usernameEmptyText() { return ""; },
|
||||
|
||||
getAccount: function(aKey, aName) { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
accountExists: function() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
// false seems an acceptable default for all options
|
||||
// (they should never be called anyway).
|
||||
get uniqueChatName() false,
|
||||
get chatHasTopic() false,
|
||||
get noPassword() false,
|
||||
get newMailNotification() false,
|
||||
get imagesInIM() false,
|
||||
get passwordOptional() true,
|
||||
get usePointSize() true,
|
||||
get registerNoScreenName() false,
|
||||
get slashCommandsNative() false,
|
||||
get usePurpleProxy() false
|
||||
get uniqueChatName() { return false; },
|
||||
get chatHasTopic() { return false; },
|
||||
get noPassword() { return false; },
|
||||
get newMailNotification() { return false; },
|
||||
get imagesInIM() { return false; },
|
||||
get passwordOptional() { return true; },
|
||||
get usePointSize() { return true; },
|
||||
get registerNoScreenName() { return false; },
|
||||
get slashCommandsNative() { return false; },
|
||||
get usePurpleProxy() { return false; }
|
||||
};
|
||||
|
||||
// An unknown prplIAccount.
|
||||
|
@ -352,7 +352,7 @@ imAccount.prototype = {
|
|||
},
|
||||
|
||||
_observedStatusInfo: null,
|
||||
get observedStatusInfo() this._observedStatusInfo,
|
||||
get observedStatusInfo() { return this._observedStatusInfo; },
|
||||
_statusObserver: null,
|
||||
set observedStatusInfo(aUserStatusInfo) {
|
||||
if (!this.prplAccount)
|
||||
|
@ -369,7 +369,7 @@ imAccount.prototype = {
|
|||
delete this._statusObserver;
|
||||
}
|
||||
},
|
||||
get statusInfo() this._observedStatusInfo || Services.core.globalUserStatus,
|
||||
get statusInfo() { return this._observedStatusInfo || Services.core.globalUserStatus; },
|
||||
|
||||
reconnectAttempt: 0,
|
||||
timeOfLastConnect: 0,
|
||||
|
@ -467,10 +467,12 @@ imAccount.prototype = {
|
|||
|
||||
// If the protocol plugin is missing, we can't access the normalizedName,
|
||||
// but in lots of cases this.name is equivalent.
|
||||
get normalizedName()
|
||||
this.prplAccount ? this.prplAccount.normalizedName : this.name,
|
||||
normalize: function(aName)
|
||||
this.prplAccount ? this.prplAccount.normalize(aName) : aName,
|
||||
get normalizedName() {
|
||||
return this.prplAccount ? this.prplAccount.normalizedName : this.name;
|
||||
},
|
||||
normalize: function(aName) {
|
||||
return this.prplAccount ? this.prplAccount.normalize(aName) : aName;
|
||||
},
|
||||
|
||||
_sendUpdateNotification: function() {
|
||||
this._sendNotification("account-updated");
|
||||
|
@ -538,8 +540,9 @@ imAccount.prototype = {
|
|||
delete this._connectionErrorReason;
|
||||
this._sendUpdateNotification();
|
||||
},
|
||||
get _passwordRequired()
|
||||
!this.protocol.noPassword && !this.protocol.passwordOptional,
|
||||
get _passwordRequired() {
|
||||
return !this.protocol.noPassword && !this.protocol.passwordOptional;
|
||||
},
|
||||
set password(aPassword) {
|
||||
this._password = aPassword;
|
||||
if (gUserCanceledMasterPasswordPrompt)
|
||||
|
@ -739,10 +742,10 @@ imAccount.prototype = {
|
|||
this._ensurePrplAccount.disconnect();
|
||||
},
|
||||
|
||||
get disconnected() this.connectionState == Ci.imIAccount.STATE_DISCONNECTED,
|
||||
get connected() this.connectionState == Ci.imIAccount.STATE_CONNECTED,
|
||||
get connecting() this.connectionState == Ci.imIAccount.STATE_CONNECTING,
|
||||
get disconnecting() this.connectionState == Ci.imIAccount.STATE_DISCONNECTING,
|
||||
get disconnected() { return this.connectionState == Ci.imIAccount.STATE_DISCONNECTED; },
|
||||
get connected() { return this.connectionState == Ci.imIAccount.STATE_CONNECTED; },
|
||||
get connecting() { return this.connectionState == Ci.imIAccount.STATE_CONNECTING; },
|
||||
get disconnecting() { return this.connectionState == Ci.imIAccount.STATE_DISCONNECTING; },
|
||||
|
||||
_cancelReconnection: function() {
|
||||
if (this._reconnectTimer) {
|
||||
|
@ -762,8 +765,9 @@ imAccount.prototype = {
|
|||
|
||||
this._cancelReconnection();
|
||||
},
|
||||
createConversation: function(aName)
|
||||
this._ensurePrplAccount.createConversation(aName),
|
||||
createConversation: function(aName) {
|
||||
return this._ensurePrplAccount.createConversation(aName);
|
||||
},
|
||||
addBuddy: function(aTag, aName) {
|
||||
this._ensurePrplAccount.addBuddy(aTag, aName);
|
||||
},
|
||||
|
@ -776,10 +780,11 @@ imAccount.prototype = {
|
|||
requestBuddyInfo: function(aBuddyName) {
|
||||
this._ensurePrplAccount.requestBuddyInfo(aBuddyName);
|
||||
},
|
||||
getChatRoomFields: function() this._ensurePrplAccount.getChatRoomFields(),
|
||||
getChatRoomDefaultFieldValues: function(aDefaultChatName)
|
||||
this._ensurePrplAccount.getChatRoomDefaultFieldValues(aDefaultChatName),
|
||||
get canJoinChat() this.prplAccount ? this.prplAccount.canJoinChat : false,
|
||||
getChatRoomFields: function() { return this._ensurePrplAccount.getChatRoomFields(); },
|
||||
getChatRoomDefaultFieldValues: function(aDefaultChatName) {
|
||||
return this._ensurePrplAccount.getChatRoomDefaultFieldValues(aDefaultChatName);
|
||||
},
|
||||
get canJoinChat() { return this.prplAccount ? this.prplAccount.canJoinChat : false; },
|
||||
joinChat: function(aComponents) {
|
||||
this._ensurePrplAccount.joinChat(aComponents);
|
||||
},
|
||||
|
@ -810,16 +815,16 @@ imAccount.prototype = {
|
|||
},
|
||||
save: function() { SavePrefTimer.saveNow(); },
|
||||
|
||||
get HTMLEnabled() this._ensurePrplAccount.HTMLEnabled,
|
||||
get HTMLEscapePlainText() this._ensurePrplAccount.HTMLEscapePlainText,
|
||||
get noBackgroundColors() this._ensurePrplAccount.noBackgroundColors,
|
||||
get autoResponses() this._ensurePrplAccount.autoResponses,
|
||||
get singleFormatting() this._ensurePrplAccount.singleFormatting,
|
||||
get noFontSizes() this._ensurePrplAccount.noFontSizes,
|
||||
get noUrlDesc() this._ensurePrplAccount.noUrlDesc,
|
||||
get noImages() this._ensurePrplAccount.noImages,
|
||||
get HTMLEnabled() { return this._ensurePrplAccount.HTMLEnabled; },
|
||||
get HTMLEscapePlainText() { return this._ensurePrplAccount.HTMLEscapePlainText; },
|
||||
get noBackgroundColors() { return this._ensurePrplAccount.noBackgroundColors; },
|
||||
get autoResponses() { return this._ensurePrplAccount.autoResponses; },
|
||||
get singleFormatting() { return this._ensurePrplAccount.singleFormatting; },
|
||||
get noFontSizes() { return this._ensurePrplAccount.noFontSizes; },
|
||||
get noUrlDesc() { return this._ensurePrplAccount.noUrlDesc; },
|
||||
get noImages() { return this._ensurePrplAccount.noImages; },
|
||||
|
||||
get proxyInfo() this._ensurePrplAccount.proxyInfo,
|
||||
get proxyInfo() { return this._ensurePrplAccount.proxyInfo; },
|
||||
set proxyInfo(val) {
|
||||
this._ensurePrplAccount.proxyInfo = val;
|
||||
this._connectionInfoChanged();
|
||||
|
@ -868,15 +873,15 @@ AccountsService.prototype = {
|
|||
|
||||
this._accounts =
|
||||
this._accountList.split(",").map(String.trim)
|
||||
.filter(function (k) k.startsWith(kAccountKeyPrefix))
|
||||
.map(function (k) parseInt(k.substr(kAccountKeyPrefix.length)))
|
||||
.filter(k => k.startsWith(kAccountKeyPrefix))
|
||||
.map(k => parseInt(k.substr(kAccountKeyPrefix.length)))
|
||||
.map(this.getAccountByNumericId, this)
|
||||
.filter(function (a) a);
|
||||
.filter(a => a);
|
||||
|
||||
Services.obs.notifyObservers(this, "account-list-updated", null);
|
||||
},
|
||||
|
||||
get _accountList() Services.prefs.getCharPref(kPrefMessengerAccounts),
|
||||
get _accountList() { return Services.prefs.getCharPref(kPrefMessengerAccounts); },
|
||||
set _accountList(aNewList) {
|
||||
this._observingAccountListChange = false;
|
||||
Services.prefs.setCharPref(kPrefMessengerAccounts, aNewList);
|
||||
|
@ -1020,8 +1025,8 @@ AccountsService.prototype = {
|
|||
this._accounts.push(aAccount);
|
||||
this._accountsById[aAccount.numericId] = aAccount;
|
||||
},
|
||||
getAccountByNumericId: function(aAccountId) this._accountsById[aAccountId],
|
||||
getAccounts: function() new nsSimpleEnumerator(this._accounts),
|
||||
getAccountByNumericId: function(aAccountId) { return this._accountsById[aAccountId]; },
|
||||
getAccounts: function() { return new nsSimpleEnumerator(this._accounts); },
|
||||
|
||||
createAccount: function(aName, aPrpl) {
|
||||
// Ensure an account with the same name and protocol doesn't already exist.
|
||||
|
@ -1077,7 +1082,7 @@ AccountsService.prototype = {
|
|||
/* Update the account list pref. */
|
||||
let list = this._accountList;
|
||||
this._accountList =
|
||||
list.split(",").filter(function (k) k.trim() != aAccountId).join(",");
|
||||
list.split(",").filter(k => k.trim() != aAccountId).join(",");
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.imIAccountsService]),
|
||||
|
|
|
@ -7,7 +7,7 @@ const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
|
|||
Cu.import("resource:///modules/imServices.jsm");
|
||||
Cu.import("resource:///modules/imXPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "_", function()
|
||||
XPCOMUtils.defineLazyGetter(this, "_", () =>
|
||||
l10nHelper("chrome://chat/locale/commands.properties")
|
||||
);
|
||||
|
||||
|
@ -20,7 +20,7 @@ CommandsService.prototype = {
|
|||
// using the /help command).
|
||||
this.registerCommand({
|
||||
name: "say",
|
||||
get helpString() _("sayHelpString"),
|
||||
get helpString() { return _("sayHelpString"); },
|
||||
usageContext: Ci.imICommand.CMD_CONTEXT_ALL,
|
||||
priority: Ci.imICommand.CMD_PRIORITY_HIGH,
|
||||
run: function(aMsg, aConv) {
|
||||
|
@ -30,7 +30,7 @@ CommandsService.prototype = {
|
|||
|
||||
this.registerCommand({
|
||||
name: "raw",
|
||||
get helpString() _("rawHelpString"),
|
||||
get helpString() { return _("rawHelpString"); },
|
||||
usageContext: Ci.imICommand.CMD_CONTEXT_ALL,
|
||||
priority: Ci.imICommand.CMD_PRIORITY_DEFAULT,
|
||||
run: function(aMsg, aConv) {
|
||||
|
@ -48,7 +48,7 @@ CommandsService.prototype = {
|
|||
cmdSrv: this,
|
||||
|
||||
name: "help",
|
||||
get helpString() _("helpHelpString"),
|
||||
get helpString() { return _("helpHelpString"); },
|
||||
usageContext: Ci.imICommand.CMD_CONTEXT_ALL,
|
||||
priority: Ci.imICommand.CMD_PRIORITY_DEFAULT,
|
||||
run: function(aMsg, aConv) {
|
||||
|
@ -64,7 +64,7 @@ CommandsService.prototype = {
|
|||
return false;
|
||||
|
||||
// Concatenate the command names (separated by a comma and space).
|
||||
let cmds = commands.map(function(aCmd) aCmd.name).sort().join(", ");
|
||||
let cmds = commands.map(aCmd => aCmd.name).sort().join(", ");
|
||||
let message = _("commands", cmds);
|
||||
|
||||
// Display the message
|
||||
|
@ -107,7 +107,7 @@ CommandsService.prototype = {
|
|||
let statusValue = Ci.imIStatusInfo["STATUS_" + status[cmd]];
|
||||
this.registerCommand({
|
||||
name: cmd,
|
||||
get helpString() _("statusCommand", this.name, _(this.name)),
|
||||
get helpString() { return _("statusCommand", this.name, _(this.name)); },
|
||||
usageContext: Ci.imICommand.CMD_CONTEXT_ALL,
|
||||
priority: Ci.imICommand.CMD_PRIORITY_HIGH,
|
||||
run: function(aMsg) {
|
||||
|
@ -172,7 +172,7 @@ CommandsService.prototype = {
|
|||
_usageContextFilter: function(aConversation) {
|
||||
let usageContext =
|
||||
Ci.imICommand["CMD_CONTEXT_" + (aConversation.isChat ? "CHAT" : "IM")];
|
||||
return function(c) c.usageContext & usageContext;
|
||||
return c => c.usageContext & usageContext;
|
||||
},
|
||||
_findCommands: function(aConversation, aName) {
|
||||
let prplId = null;
|
||||
|
@ -222,7 +222,7 @@ CommandsService.prototype = {
|
|||
}
|
||||
|
||||
// Sort the matching commands by priority before returning the array.
|
||||
return cmdArray.sort(function(a, b) b.priority - a.priority);
|
||||
return cmdArray.sort((a, b) => b.priority - a.priority);
|
||||
},
|
||||
executeCommand: function(aMessage, aConversation, aReturnedConv) {
|
||||
if (!aMessage)
|
||||
|
|
|
@ -6,7 +6,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
|||
Cu.import("resource:///modules/imXPCOMUtils.jsm");
|
||||
Cu.import("resource:///modules/imServices.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "_", function()
|
||||
XPCOMUtils.defineLazyGetter(this, "_", () =>
|
||||
l10nHelper("chrome://chat/locale/contacts.properties")
|
||||
);
|
||||
|
||||
|
@ -117,8 +117,8 @@ this.__defineGetter__("DBConn", function() {
|
|||
|
||||
function TagsService() { }
|
||||
TagsService.prototype = {
|
||||
get wrappedJSObject() this,
|
||||
get defaultTag() this.createTag(_("defaultGroup")),
|
||||
get wrappedJSObject() { return this; },
|
||||
get defaultTag() { return this.createTag(_("defaultGroup")); },
|
||||
createTag: function(aName) {
|
||||
// If the tag already exists, we don't want to create a duplicate.
|
||||
let tag = this.getTagByName(aName);
|
||||
|
@ -138,7 +138,7 @@ TagsService.prototype = {
|
|||
return tag;
|
||||
},
|
||||
// Get an existing tag by (numeric) id. Returns null if not found.
|
||||
getTagById: function(aId) TagsById[aId],
|
||||
getTagById: aId => TagsById[aId],
|
||||
// Get an existing tag by name (will do an SQL query). Returns null
|
||||
// if not found.
|
||||
getTagByName: function(aName) {
|
||||
|
@ -155,7 +155,7 @@ TagsService.prototype = {
|
|||
// Get an array of all existing tags.
|
||||
getTags: function(aTagCount) {
|
||||
if (Tags.length)
|
||||
Tags.sort(function(a, b) a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
||||
Tags.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
||||
else
|
||||
this.defaultTag;
|
||||
|
||||
|
@ -164,7 +164,7 @@ TagsService.prototype = {
|
|||
return Tags;
|
||||
},
|
||||
|
||||
isTagHidden: function(aTag) aTag.id in otherContactsTag._hiddenTags,
|
||||
isTagHidden: aTag => aTag.id in otherContactsTag._hiddenTags,
|
||||
hideTag: function(aTag) { otherContactsTag.hideTag(aTag); },
|
||||
showTag: function(aTag) { otherContactsTag.showTag(aTag); },
|
||||
get otherContactsTag() {
|
||||
|
@ -191,8 +191,8 @@ function Tag(aId, aName) {
|
|||
TagsById[this.id] = this;
|
||||
}
|
||||
Tag.prototype = {
|
||||
get id() this._id,
|
||||
get name() this._name,
|
||||
get id() { return this._id; },
|
||||
get name() { return this._name; },
|
||||
set name(aNewName) {
|
||||
let statement = DBConn.createStatement("UPDATE tags SET name = :name WHERE id = :id");
|
||||
try {
|
||||
|
@ -207,7 +207,7 @@ Tag.prototype = {
|
|||
return aNewName;
|
||||
},
|
||||
getContacts: function(aContactCount) {
|
||||
let contacts = this._contacts.filter(function(c) !c._empty);
|
||||
let contacts = this._contacts.filter(c => !c._empty);
|
||||
if (aContactCount)
|
||||
aContactCount.value = contacts.length;
|
||||
return contacts;
|
||||
|
@ -226,7 +226,7 @@ Tag.prototype = {
|
|||
this._observers.push(aObserver);
|
||||
},
|
||||
removeObserver: function(aObserver) {
|
||||
this._observers = this._observers.filter(function(o) o !== aObserver);
|
||||
this._observers = this._observers.filter(o => o !== aObserver);
|
||||
},
|
||||
notifyObservers: function(aSubject, aTopic, aData) {
|
||||
for each (let observer in this._observers)
|
||||
|
@ -238,7 +238,7 @@ Tag.prototype = {
|
|||
countRef.value = interfaces.length;
|
||||
return interfaces;
|
||||
},
|
||||
getHelperForLanguage: function(language) null,
|
||||
getHelperForLanguage: language => null,
|
||||
implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
|
||||
flags: 0,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.imITag, Ci.nsIClassInfo])
|
||||
|
@ -257,7 +257,7 @@ var otherContactsTag = {
|
|||
let id = aTag.id;
|
||||
delete this._hiddenTags[id];
|
||||
for each (let contact in this._contacts)
|
||||
if (contact.getTags().some(function(t) t.id == id))
|
||||
if (contact.getTags().some(t => t.id == id))
|
||||
this._removeContact(contact);
|
||||
|
||||
aTag.notifyObservers(aTag, "tag-shown", null);
|
||||
|
@ -279,7 +279,7 @@ var otherContactsTag = {
|
|||
_hideTag: function(aTag) {
|
||||
for each (let contact in aTag.getContacts())
|
||||
if (!(contact.id in this._contacts) &&
|
||||
contact.getTags().every(function(t) t.id in this._hiddenTags, this))
|
||||
contact.getTags().every(t => t.id in this._hiddenTags))
|
||||
this._addContact(contact);
|
||||
},
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
|
@ -287,7 +287,7 @@ var otherContactsTag = {
|
|||
if (aTopic == "contact-tag-removed" || aTopic == "contact-added") {
|
||||
if (!(aSubject.id in this._contacts) &&
|
||||
!(parseInt(aData) in this._hiddenTags) &&
|
||||
aSubject.getTags().every(function(t) t.id in this._hiddenTags, this))
|
||||
aSubject.getTags().every(t => t.id in this._hiddenTags))
|
||||
this._addContact(aSubject);
|
||||
}
|
||||
else if (aSubject.id in this._contacts &&
|
||||
|
@ -328,8 +328,8 @@ var otherContactsTag = {
|
|||
},
|
||||
|
||||
// imITag implementation
|
||||
get id() -1,
|
||||
get name() "__others__",
|
||||
get id() { return -1; },
|
||||
get name() { return "__others__"; },
|
||||
set name(aNewName) { throw Cr.NS_ERROR_NOT_AVAILABLE; },
|
||||
getContacts: function(aContactCount) {
|
||||
let contacts = [contact for each (contact in this._contacts)];
|
||||
|
@ -357,7 +357,7 @@ var otherContactsTag = {
|
|||
this._observers.push(aObserver);
|
||||
},
|
||||
removeObserver: function(aObserver) {
|
||||
this._observers = this._observers.filter(function(o) o !== aObserver);
|
||||
this._observers = this._observers.filter(o => o !== aObserver);
|
||||
},
|
||||
notifyObservers: function(aSubject, aTopic, aData) {
|
||||
for each (let observer in this._observers)
|
||||
|
@ -369,7 +369,7 @@ var otherContactsTag = {
|
|||
countRef.value = interfaces.length;
|
||||
return interfaces;
|
||||
},
|
||||
getHelperForLanguage: function(language) null,
|
||||
getHelperForLanguage: language => null,
|
||||
implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
|
||||
flags: 0,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.imITag, Ci.nsIObserver, Ci.nsIClassInfo])
|
||||
|
@ -390,8 +390,8 @@ function Contact(aId, aAlias) {
|
|||
}
|
||||
Contact.prototype = {
|
||||
_id: 0,
|
||||
get id() this._id,
|
||||
get alias() this._alias,
|
||||
get id() { return this._id; },
|
||||
get alias() { return this._alias; },
|
||||
set alias(aNewAlias) {
|
||||
this._ensureNotDummy();
|
||||
|
||||
|
@ -466,7 +466,7 @@ Contact.prototype = {
|
|||
|
||||
this._removeContactTagRow(aTag);
|
||||
|
||||
this._tags = this._tags.filter(function(tag) tag.id != aTag.id);
|
||||
this._tags = this._tags.filter(tag => tag.id != aTag.id);
|
||||
aTag = TagsById[aTag.id];
|
||||
aTag._removeContact(this);
|
||||
|
||||
|
@ -483,7 +483,7 @@ Contact.prototype = {
|
|||
statement.params.tagId = aTag.id;
|
||||
executeAsyncThenFinalize(statement);
|
||||
},
|
||||
hasTag: function(aTag) this._tags.some(function (t) t.id == aTag.id),
|
||||
hasTag: function(aTag) { return this._tags.some((t => t.id == aTag.id)); },
|
||||
_massMove: false,
|
||||
removeTag: function(aTag) {
|
||||
if (!this.hasTag(aTag))
|
||||
|
@ -498,7 +498,7 @@ Contact.prototype = {
|
|||
this._buddies.forEach(function (aBuddy) {
|
||||
aBuddy._accounts.forEach(function (aAccountBuddy) {
|
||||
if (aAccountBuddy.tag.id == aTag.id) {
|
||||
if (aBuddy._accounts.some(function(ab)
|
||||
if (aBuddy._accounts.some(ab =>
|
||||
ab.account.numericId == aAccountBuddy.account.numericId &&
|
||||
ab.tag.id != aTag.id && hasTag(ab.tag))) {
|
||||
// A buddy that already has an accountBuddy of the same
|
||||
|
@ -554,7 +554,7 @@ Contact.prototype = {
|
|||
// Apply the changes.
|
||||
let tags = this._tags;
|
||||
if (shouldRemove) {
|
||||
tags = tags.filter(function(aTag) aTag.id != aOldTag.id);
|
||||
tags = tags.filter(aTag => aTag.id != aOldTag.id);
|
||||
aOldTag._removeContact(this);
|
||||
}
|
||||
if (shouldAdd) {
|
||||
|
@ -584,8 +584,10 @@ Contact.prototype = {
|
|||
aBuddyCount.value = this._buddies.length;
|
||||
return this._buddies;
|
||||
},
|
||||
get _empty() this._buddies.length == 0 ||
|
||||
this._buddies.every(function(b) b._empty),
|
||||
get _empty() {
|
||||
return this._buddies.length == 0 ||
|
||||
this._buddies.every(b => b._empty);
|
||||
},
|
||||
|
||||
mergeContact: function(aContact) {
|
||||
// Avoid merging the contact with itself or merging into an
|
||||
|
@ -664,7 +666,7 @@ Contact.prototype = {
|
|||
if (index == -1)
|
||||
throw "Removing an unknown buddy from contact " + this._id;
|
||||
|
||||
this._buddies = this._buddies.filter(function(b) b !== aBuddy);
|
||||
this._buddies = this._buddies.filter(b => b !== aBuddy);
|
||||
|
||||
// If we are actually removing the whole contact, don't bother updating
|
||||
// the positions or the preferred buddy.
|
||||
|
@ -817,21 +819,21 @@ Contact.prototype = {
|
|||
this._notifyObservers(aTopic);
|
||||
}, this);
|
||||
},
|
||||
get displayName() this._alias || this.preferredBuddy.displayName,
|
||||
get buddyIconFilename() this.preferredBuddy.buddyIconFilename,
|
||||
get displayName() { return this._alias || this.preferredBuddy.displayName; },
|
||||
get buddyIconFilename() { return this.preferredBuddy.buddyIconFilename; },
|
||||
_statusType: 0,
|
||||
get statusType() this._statusType,
|
||||
get online() this.statusType > Ci.imIStatusInfo.STATUS_OFFLINE,
|
||||
get available() this.statusType == Ci.imIStatusInfo.STATUS_AVAILABLE,
|
||||
get idle() this.statusType == Ci.imIStatusInfo.STATUS_IDLE,
|
||||
get mobile() this.statusType == Ci.imIStatusInfo.STATUS_MOBILE,
|
||||
get statusType() { return this._statusType; },
|
||||
get online() { return this.statusType > Ci.imIStatusInfo.STATUS_OFFLINE; },
|
||||
get available() { return this.statusType == Ci.imIStatusInfo.STATUS_AVAILABLE; },
|
||||
get idle() { return this.statusType == Ci.imIStatusInfo.STATUS_IDLE; },
|
||||
get mobile() { return this.statusType == Ci.imIStatusInfo.STATUS_MOBILE; },
|
||||
_statusText: "",
|
||||
get statusText() this._statusText,
|
||||
get statusText() { return this._statusText; },
|
||||
_availabilityDetails: 0,
|
||||
get availabilityDetails() this._availabilityDetails,
|
||||
get canSendMessage() this.preferredBuddy.canSendMessage,
|
||||
get availabilityDetails() { return this._availabilityDetails; },
|
||||
get canSendMessage() { return this.preferredBuddy.canSendMessage; },
|
||||
//XXX should we list the buddies in the tooltip?
|
||||
getTooltipInfo: function() this.preferredBuddy.getTooltipInfo(),
|
||||
getTooltipInfo: function() { return this.preferredBuddy.getTooltipInfo(); },
|
||||
createConversation: function() {
|
||||
let uiConv = Services.conversations.getUIConversationByContactId(this.id);
|
||||
if (uiConv)
|
||||
|
@ -847,7 +849,7 @@ Contact.prototype = {
|
|||
if (!this.hasOwnProperty("_observers"))
|
||||
return;
|
||||
|
||||
this._observers = this._observers.filter(function(o) o !== aObserver);
|
||||
this._observers = this._observers.filter(o => o !== aObserver);
|
||||
},
|
||||
// internal calls + calls from add-ons
|
||||
notifyObservers: function(aSubject, aTopic, aData) {
|
||||
|
@ -900,7 +902,7 @@ Contact.prototype = {
|
|||
countRef.value = interfaces.length;
|
||||
return interfaces;
|
||||
},
|
||||
getHelperForLanguage: function(language) null,
|
||||
getHelperForLanguage: language => null,
|
||||
implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
|
||||
flags: 0,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.imIContact, Ci.nsIClassInfo])
|
||||
|
@ -927,7 +929,7 @@ function Buddy(aId, aKey, aName, aSrvAlias, aContactId) {
|
|||
BuddiesById[this._id] = this;
|
||||
}
|
||||
Buddy.prototype = {
|
||||
get id() this._id,
|
||||
get id() { return this._id; },
|
||||
destroy: function() {
|
||||
for each (let ab in this._accounts)
|
||||
ab.unInit();
|
||||
|
@ -935,12 +937,12 @@ Buddy.prototype = {
|
|||
delete this._observers;
|
||||
delete this._preferredAccount;
|
||||
},
|
||||
get protocol() this._accounts[0].account.protocol,
|
||||
get userName() this._name,
|
||||
get normalizedName() this._key,
|
||||
get protocol() { return this._accounts[0].account.protocol; },
|
||||
get userName() { return this._name; },
|
||||
get normalizedName() { return this._key; },
|
||||
_srvAlias: "",
|
||||
_contact: null,
|
||||
get contact() this._contact,
|
||||
get contact() { return this._contact; },
|
||||
set contact(aContact) /* not in imIBuddy */ {
|
||||
if (aContact.id == this._contact.id)
|
||||
throw Components.results.NS_ERROR_INVALID_ARG;
|
||||
|
@ -991,7 +993,7 @@ Buddy.prototype = {
|
|||
if (!this._preferredAccount)
|
||||
this._preferredAccount = aAccountBuddy;
|
||||
},
|
||||
get _empty() this._accounts.length == 0,
|
||||
get _empty() { return this._accounts.length == 0; },
|
||||
|
||||
remove: function() {
|
||||
for each (let account in this._accounts)
|
||||
|
@ -1000,7 +1002,7 @@ Buddy.prototype = {
|
|||
|
||||
// imIStatusInfo implementation
|
||||
_preferredAccount: null,
|
||||
get preferredAccountBuddy() this._preferredAccount,
|
||||
get preferredAccountBuddy() { return this._preferredAccount; },
|
||||
_isPreferredAccount: function(aAccountBuddy) {
|
||||
if (aAccountBuddy.account.numericId != this._preferredAccount.account.numericId)
|
||||
return false;
|
||||
|
@ -1094,23 +1096,25 @@ Buddy.prototype = {
|
|||
this._notifyObservers(aTopic);
|
||||
}, this);
|
||||
},
|
||||
get displayName() this._preferredAccount && this._preferredAccount.displayName ||
|
||||
this._srvAlias || this._name,
|
||||
get buddyIconFilename() this._preferredAccount.buddyIconFilename,
|
||||
get displayName() {
|
||||
return this._preferredAccount && this._preferredAccount.displayName ||
|
||||
this._srvAlias || this._name;
|
||||
},
|
||||
get buddyIconFilename() { return this._preferredAccount.buddyIconFilename; },
|
||||
_statusType: 0,
|
||||
get statusType() this._statusType,
|
||||
get online() this.statusType > Ci.imIStatusInfo.STATUS_OFFLINE,
|
||||
get available() this.statusType == Ci.imIStatusInfo.STATUS_AVAILABLE,
|
||||
get idle() this.statusType == Ci.imIStatusInfo.STATUS_IDLE,
|
||||
get mobile() this.statusType == Ci.imIStatusInfo.STATUS_MOBILE,
|
||||
get statusType() { return this._statusType; },
|
||||
get online() { return this.statusType > Ci.imIStatusInfo.STATUS_OFFLINE; },
|
||||
get available() { return this.statusType == Ci.imIStatusInfo.STATUS_AVAILABLE; },
|
||||
get idle() { return this.statusType == Ci.imIStatusInfo.STATUS_IDLE; },
|
||||
get mobile() { return this.statusType == Ci.imIStatusInfo.STATUS_MOBILE; },
|
||||
_statusText: "",
|
||||
get statusText() this._statusText,
|
||||
get statusText() { return this._statusText; },
|
||||
_availabilityDetails: 0,
|
||||
get availabilityDetails() this._availabilityDetails,
|
||||
get canSendMessage() this._preferredAccount.canSendMessage,
|
||||
get availabilityDetails() { return this._availabilityDetails; },
|
||||
get canSendMessage() { return this._preferredAccount.canSendMessage; },
|
||||
//XXX should we list the accounts in the tooltip?
|
||||
getTooltipInfo: function() this._preferredAccount.getTooltipInfo(),
|
||||
createConversation: function() this._preferredAccount.createConversation(),
|
||||
getTooltipInfo: function() { return this._preferredAccount.getTooltipInfo(); },
|
||||
createConversation: function() { return this._preferredAccount.createConversation(); },
|
||||
|
||||
addObserver: function(aObserver) {
|
||||
if (this._observers.indexOf(aObserver) == -1)
|
||||
|
@ -1119,7 +1123,7 @@ Buddy.prototype = {
|
|||
removeObserver: function(aObserver) {
|
||||
if (!this._observers)
|
||||
return;
|
||||
this._observers = this._observers.filter(function(o) o !== aObserver);
|
||||
this._observers = this._observers.filter(o => o !== aObserver);
|
||||
},
|
||||
// internal calls + calls from add-ons
|
||||
notifyObservers: function(aSubject, aTopic, aData) {
|
||||
|
@ -1215,7 +1219,7 @@ Buddy.prototype = {
|
|||
countRef.value = interfaces.length;
|
||||
return interfaces;
|
||||
},
|
||||
getHelperForLanguage: function(language) null,
|
||||
getHelperForLanguage: language => null,
|
||||
implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
|
||||
flags: 0,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.imIBuddy, Ci.nsIClassInfo])
|
||||
|
@ -1313,7 +1317,7 @@ ContactsService.prototype = {
|
|||
ContactsById = { };
|
||||
},
|
||||
|
||||
getContactById: function(aId) ContactsById[aId],
|
||||
getContactById: aId => ContactsById[aId],
|
||||
// Get an array of all existing contacts.
|
||||
getContacts: function(aContactCount) {
|
||||
let contacts = [ContactsById[id] for (id in ContactsById) if (!ContactsById[id]._empty)];
|
||||
|
@ -1321,7 +1325,7 @@ ContactsService.prototype = {
|
|||
aContactCount.value = contacts.length;
|
||||
return contacts;
|
||||
},
|
||||
getBuddyById: function(aId) BuddiesById[aId],
|
||||
getBuddyById: aId => BuddiesById[aId],
|
||||
getBuddyByNameAndProtocol: function(aNormalizedName, aPrpl) {
|
||||
let statement =
|
||||
DBConn.createStatement("SELECT b.id FROM buddies b " +
|
||||
|
|
|
@ -11,7 +11,7 @@ Cu.import("resource:///modules/jsProtoHelper.jsm");
|
|||
var gLastUIConvId = 0;
|
||||
var gLastPrplConvId = 0;
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "bundle", function()
|
||||
XPCOMUtils.defineLazyGetter(this, "bundle", () =>
|
||||
Services.strings.createBundle("chrome://chat/locale/conversations.properties")
|
||||
);
|
||||
|
||||
|
@ -42,31 +42,31 @@ imMessage.prototype = {
|
|||
},
|
||||
set displayMessage(aMsg) { this._displayMessage = aMsg; },
|
||||
|
||||
get message() this.prplMessage.message,
|
||||
get message() { return this.prplMessage.message; },
|
||||
set message(aMsg) { this.prplMessage.message = aMsg; },
|
||||
|
||||
// from prplIMessage
|
||||
get who() this.prplMessage.who,
|
||||
get time() this.prplMessage.time,
|
||||
get id() this.prplMessage.id,
|
||||
get alias() this.prplMessage.alias,
|
||||
get iconURL() this.prplMessage.iconURL,
|
||||
get conversation() this.prplMessage.conversation,
|
||||
get who() { return this.prplMessage.who; },
|
||||
get time() { return this.prplMessage.time; },
|
||||
get id() { return this.prplMessage.id; },
|
||||
get alias() { return this.prplMessage.alias; },
|
||||
get iconURL() { return this.prplMessage.iconURL; },
|
||||
get conversation() { return this.prplMessage.conversation; },
|
||||
set conversation(aConv) { this.prplMessage.conversation = aConv; },
|
||||
get outgoing() this.prplMessage.outgoing,
|
||||
get incoming() this.prplMessage.incoming,
|
||||
get system() this.prplMessage.system,
|
||||
get autoResponse() this.prplMessage.autoResponse,
|
||||
get containsNick() this.prplMessage.containsNick,
|
||||
get noLog() this.prplMessage.noLog,
|
||||
get error() this.prplMessage.error,
|
||||
get delayed() this.prplMessage.delayed,
|
||||
get noFormat() this.prplMessage.noFormat,
|
||||
get containsImages() this.prplMessage.containsImages,
|
||||
get notification() this.prplMessage.notification,
|
||||
get noLinkification() this.prplMessage.noLinkification,
|
||||
get originalMessage() this.prplMessage.originalMessage,
|
||||
getActions: function(aCount) this.prplMessage.getActions(aCount || {})
|
||||
get outgoing() { return this.prplMessage.outgoing; },
|
||||
get incoming() { return this.prplMessage.incoming; },
|
||||
get system() { return this.prplMessage.system; },
|
||||
get autoResponse() { return this.prplMessage.autoResponse; },
|
||||
get containsNick() { return this.prplMessage.containsNick; },
|
||||
get noLog() { return this.prplMessage.noLog; },
|
||||
get error() { return this.prplMessage.error; },
|
||||
get delayed() { return this.prplMessage.delayed; },
|
||||
get noFormat() { return this.prplMessage.noFormat; },
|
||||
get containsImages() { return this.prplMessage.containsImages; },
|
||||
get notification() { return this.prplMessage.notification; },
|
||||
get noLinkification() { return this.prplMessage.noLinkification; },
|
||||
get originalMessage() { return this.prplMessage.originalMessage; },
|
||||
getActions: function(aCount) { return this.prplMessage.getActions(aCount || {}); }
|
||||
};
|
||||
|
||||
function UIConversation(aPrplConversation)
|
||||
|
@ -105,11 +105,11 @@ UIConversation.prototype = {
|
|||
delete this._observedContact;
|
||||
}
|
||||
},
|
||||
get target() this._prplConv[this._currentTargetId],
|
||||
get target() { return this._prplConv[this._currentTargetId]; },
|
||||
set target(aPrplConversation) {
|
||||
this.changeTargetTo(aPrplConversation);
|
||||
},
|
||||
get hasMultipleTargets() Object.keys(this._prplConv).length > 1,
|
||||
get hasMultipleTargets() { return Object.keys(this._prplConv).length > 1; },
|
||||
getTargetByAccount: function(aAccount) {
|
||||
let accountId = aAccount.id;
|
||||
for (let id in this._prplConv) {
|
||||
|
@ -176,11 +176,11 @@ UIConversation.prototype = {
|
|||
},
|
||||
|
||||
_unreadMessageCount: 0,
|
||||
get unreadMessageCount() this._unreadMessageCount,
|
||||
get unreadMessageCount() { return this._unreadMessageCount; },
|
||||
_unreadTargetedMessageCount: 0,
|
||||
get unreadTargetedMessageCount() this._unreadTargetedMessageCount,
|
||||
get unreadTargetedMessageCount() { return this._unreadTargetedMessageCount; },
|
||||
_unreadIncomingMessageCount: 0,
|
||||
get unreadIncomingMessageCount() this._unreadIncomingMessageCount,
|
||||
get unreadIncomingMessageCount() { return this._unreadIncomingMessageCount; },
|
||||
markAsRead: function() {
|
||||
delete this._unreadMessageCount;
|
||||
delete this._unreadTargetedMessageCount;
|
||||
|
@ -345,12 +345,12 @@ UIConversation.prototype = {
|
|||
},
|
||||
|
||||
// prplIConversation
|
||||
get isChat() this.target.isChat,
|
||||
get account() this.target.account,
|
||||
get name() this.target.name,
|
||||
get normalizedName() this.target.normalizedName,
|
||||
get title() this.target.title,
|
||||
get startDate() this.target.startDate,
|
||||
get isChat() { return this.target.isChat; },
|
||||
get account() { return this.target.account; },
|
||||
get name() { return this.target.name; },
|
||||
get normalizedName() { return this.target.normalizedName; },
|
||||
get title() { return this.target.title; },
|
||||
get startDate() { return this.target.startDate; },
|
||||
sendMsg: function(aMsg) {
|
||||
// Add-ons (eg. pastebin) have an opportunity to cancel the message at this
|
||||
// point, or change the text content of the message.
|
||||
|
@ -406,7 +406,7 @@ UIConversation.prototype = {
|
|||
this._observers.push(aObserver);
|
||||
},
|
||||
removeObserver: function(aObserver) {
|
||||
this._observers = this._observers.filter(function(o) o !== aObserver);
|
||||
this._observers = this._observers.filter(o => o !== aObserver);
|
||||
},
|
||||
notifyObservers: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == "new-text") {
|
||||
|
@ -448,26 +448,26 @@ UIConversation.prototype = {
|
|||
prepareForDisplaying: function(aMsg) {},
|
||||
|
||||
// prplIConvIM
|
||||
get buddy() this.target.buddy,
|
||||
get typingState() this.target.typingState,
|
||||
sendTyping: function(aString) this.target.sendTyping(aString),
|
||||
get buddy() { return this.target.buddy; },
|
||||
get typingState() { return this.target.typingState; },
|
||||
sendTyping: function(aString) { return this.target.sendTyping(aString); },
|
||||
|
||||
// Chat only
|
||||
getParticipants: function() this.target.getParticipants(),
|
||||
get topic() this.target.topic,
|
||||
getParticipants: function() { return this.target.getParticipants(); },
|
||||
get topic() { return this.target.topic; },
|
||||
set topic(aTopic) { this.target.topic = aTopic; },
|
||||
get topicSetter() this.target.topicSetter,
|
||||
get topicSettable() this.target.topicSettable,
|
||||
get noTopicString() bundle.GetStringFromName("noTopic"),
|
||||
get nick() this.target.nick,
|
||||
get left() this.target.left,
|
||||
get joining() this.target.joining
|
||||
get topicSetter() { return this.target.topicSetter; },
|
||||
get topicSettable() { return this.target.topicSettable; },
|
||||
get noTopicString() { return bundle.GetStringFromName("noTopic"); },
|
||||
get nick() { return this.target.nick; },
|
||||
get left() { return this.target.left; },
|
||||
get joining() { return this.target.joining; }
|
||||
};
|
||||
|
||||
var gConversationsService;
|
||||
function ConversationsService() { gConversationsService = this; }
|
||||
ConversationsService.prototype = {
|
||||
get wrappedJSObject() this,
|
||||
get wrappedJSObject() { return this; },
|
||||
|
||||
initConversations: function() {
|
||||
this._uiConv = {};
|
||||
|
@ -603,7 +603,7 @@ ConversationsService.prototype = {
|
|||
aPrplConversation.unInit();
|
||||
|
||||
this._prplConversations =
|
||||
this._prplConversations.filter(function(c) c !== aPrplConversation);
|
||||
this._prplConversations.filter(c => c !== aPrplConversation);
|
||||
},
|
||||
|
||||
getUIConversations: function(aConvCount) {
|
||||
|
@ -628,10 +628,11 @@ ConversationsService.prototype = {
|
|||
return this._uiConv[id];
|
||||
throw "Unknown conversation";
|
||||
},
|
||||
getUIConversationByContactId: function(aId)
|
||||
(aId in this._uiConvByContactId) ? this._uiConvByContactId[aId] : null,
|
||||
getUIConversationByContactId: function(aId) {
|
||||
return (aId in this._uiConvByContactId) ? this._uiConvByContactId[aId] : null;
|
||||
},
|
||||
|
||||
getConversations: function() new nsSimpleEnumerator(this._prplConversations),
|
||||
getConversations: function() { return new nsSimpleEnumerator(this._prplConversations); },
|
||||
getConversationById: function(aId) {
|
||||
for each (let conv in this._prplConversations)
|
||||
if (conv.id == aId)
|
||||
|
|
|
@ -116,7 +116,7 @@ UserStatus.prototype = {
|
|||
},
|
||||
|
||||
_idleTime: 0,
|
||||
get idleTime() this._idleTime,
|
||||
get idleTime() { return this._idleTime; },
|
||||
set idleTime(aIdleTime) {
|
||||
this._idleTime = aIdleTime;
|
||||
this._notifyObservers("idle-time-changed", aIdleTime);
|
||||
|
@ -152,9 +152,9 @@ UserStatus.prototype = {
|
|||
},
|
||||
|
||||
_statusText: "",
|
||||
get statusText() this._statusText || this._idleStatusText,
|
||||
get statusText() { return this._statusText || this._idleStatusText; },
|
||||
_statusType: Ci.imIStatusInfo.STATUS_AVAILABLE,
|
||||
get statusType() Math.min(this._statusType, this._idleStatusType, this._offlineStatusType),
|
||||
get statusType() { return Math.min(this._statusType, this._idleStatusType, this._offlineStatusType); },
|
||||
setStatus: function(aStatus, aMessage) {
|
||||
if (aStatus != Ci.imIStatusInfo.STATUS_UNKNOWN)
|
||||
this._statusType = aStatus;
|
||||
|
@ -163,8 +163,7 @@ UserStatus.prototype = {
|
|||
this._notifyObservers("status-changed", aMessage);
|
||||
},
|
||||
|
||||
_getProfileDir: function()
|
||||
Services.dirsvc.get("ProfD", Ci.nsIFile),
|
||||
_getProfileDir: () => Services.dirsvc.get("ProfD", Ci.nsIFile),
|
||||
setUserIcon: function(aIconFile) {
|
||||
let folder = this._getProfileDir();
|
||||
|
||||
|
@ -214,8 +213,10 @@ UserStatus.prototype = {
|
|||
return Services.io.newFileURI(file);
|
||||
},
|
||||
|
||||
get displayName() Services.prefs.getComplexValue(kPrefUserDisplayname,
|
||||
Ci.nsISupportsString).data,
|
||||
get displayName() {
|
||||
return Services.prefs.getComplexValue(kPrefUserDisplayname,
|
||||
Ci.nsISupportsString).data;
|
||||
},
|
||||
set displayName(aDisplayName) {
|
||||
let str = Cc["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Ci.nsISupportsString);
|
||||
|
@ -230,7 +231,7 @@ UserStatus.prototype = {
|
|||
this._observers.push(aObserver);
|
||||
},
|
||||
removeObserver: function(aObserver) {
|
||||
this._observers = this._observers.filter(function(o) o !== aObserver);
|
||||
this._observers = this._observers.filter(o => o !== aObserver);
|
||||
},
|
||||
_notifyObservers: function(aTopic, aData) {
|
||||
for each (let observer in this._observers)
|
||||
|
@ -244,7 +245,7 @@ CoreService.prototype = {
|
|||
globalUserStatus: null,
|
||||
|
||||
_initialized: false,
|
||||
get initialized() this._initialized,
|
||||
get initialized() { return this._initialized; },
|
||||
init: function() {
|
||||
if (this._initialized)
|
||||
return;
|
||||
|
|
|
@ -12,7 +12,7 @@ Cu.import("resource:///modules/jsProtoHelper.jsm");
|
|||
Cu.import("resource://gre/modules/Task.jsm")
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "_", function()
|
||||
XPCOMUtils.defineLazyGetter(this, "_", () =>
|
||||
l10nHelper("chrome://chat/locale/logger.properties")
|
||||
);
|
||||
|
||||
|
@ -104,7 +104,7 @@ function encodeName(aName) {
|
|||
|
||||
// Reserved characters are replaced by %[hex value]. encodeURIComponent() is
|
||||
// not sufficient, nevertheless decodeURIComponent() can be used to decode.
|
||||
function encodeReservedChars(match) "%" + match.charCodeAt(0).toString(16);
|
||||
function encodeReservedChars(match) { return "%" + match.charCodeAt(0).toString(16); }
|
||||
return aName.replace(/[<>:"\/\\|?*&%]/g, encodeReservedChars);
|
||||
}
|
||||
|
||||
|
@ -137,8 +137,9 @@ function getNewLogFileName(aFormat, aStartTime) {
|
|||
dateTime += "-";
|
||||
let minutes = offset % 60;
|
||||
offset = (offset - minutes) / 60;
|
||||
function twoDigits(aNumber)
|
||||
aNumber == 0 ? "00" : aNumber < 10 ? "0" + aNumber : aNumber;
|
||||
function twoDigits(aNumber) {
|
||||
return aNumber == 0 ? "00" : aNumber < 10 ? "0" + aNumber : aNumber;
|
||||
}
|
||||
if (!aFormat)
|
||||
aFormat = "txt";
|
||||
return dateTime + twoDigits(offset) + twoDigits(minutes) + "." + aFormat;
|
||||
|
@ -265,7 +266,7 @@ LogWriter.prototype = {
|
|||
flags: ["outgoing", "incoming", "system", "autoResponse",
|
||||
"containsNick", "error", "delayed",
|
||||
"noFormat", "containsImages", "notification",
|
||||
"noLinkification"].filter(function(f) aMessage[f])
|
||||
"noLinkification"].filter(f => aMessage[f])
|
||||
};
|
||||
let alias = aMessage.alias;
|
||||
if (alias && alias != msg.who)
|
||||
|
@ -428,7 +429,7 @@ function LogMessage(aData, aConversation) {
|
|||
LogMessage.prototype = {
|
||||
__proto__: GenericMessagePrototype,
|
||||
_interfaces: [Ci.imIMessage, Ci.prplIMessage],
|
||||
get displayMessage() this.originalMessage
|
||||
get displayMessage() { return this.originalMessage; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -439,19 +440,19 @@ function LogConversation(aMessages, aProperties) {
|
|||
}
|
||||
LogConversation.prototype = {
|
||||
__proto__: ClassInfo("imILogConversation", "Log conversation object"),
|
||||
get isChat() this._isChat,
|
||||
get buddy() null,
|
||||
get account() ({
|
||||
get isChat() { return this._isChat; },
|
||||
get buddy() { return null; },
|
||||
get account() { return {
|
||||
alias: "",
|
||||
name: this._accountName,
|
||||
normalizedName: this._accountName,
|
||||
protocol: {name: this._protocolName},
|
||||
statusInfo: Services.core.globalUserStatus
|
||||
}),
|
||||
}; },
|
||||
getMessages: function(aMessageCount) {
|
||||
if (aMessageCount)
|
||||
aMessageCount.value = this._messages.length;
|
||||
return this._messages.map(function(m) new LogMessage(m, this), this);
|
||||
return this._messages.map(m => new LogMessage(m, this));
|
||||
},
|
||||
getMessagesEnumerator: function(aMessageCount) {
|
||||
if (aMessageCount)
|
||||
|
@ -460,8 +461,8 @@ LogConversation.prototype = {
|
|||
_index: 0,
|
||||
_conv: this,
|
||||
_messages: this._messages,
|
||||
hasMoreElements: function() this._index < this._messages.length,
|
||||
getNext: function() new LogMessage(this._messages[this._index++], this._conv),
|
||||
hasMoreElements: function() { return this._index < this._messages.length; },
|
||||
getNext: function() { return new LogMessage(this._messages[this._index++], this._conv); },
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISimpleEnumerator])
|
||||
};
|
||||
return enumerator;
|
||||
|
@ -505,7 +506,7 @@ function Log(aEntries) {
|
|||
|
||||
// Assume aEntries is an array of objects.
|
||||
// Sort our list of entries for this day in increasing order.
|
||||
aEntries.sort(function(aLeft, aRight) aLeft.time - aRight.time);
|
||||
aEntries.sort((aLeft, aRight) => aLeft.time - aRight.time);
|
||||
|
||||
this._entryPaths = [entry.path for (entry of aEntries)];
|
||||
// Calculate the timestamp for the first entry down to the day.
|
||||
|
@ -658,7 +659,7 @@ DailyLogEnumerator.prototype = {
|
|||
_entries: {},
|
||||
_days: [],
|
||||
_index: 0,
|
||||
hasMoreElements: function() this._index < this._days.length,
|
||||
hasMoreElements: function() { return this._index < this._days.length; },
|
||||
getNext: function() {
|
||||
let dayID = this._days[this._index++];
|
||||
return new Log(this._entries[dayID]);
|
||||
|
@ -793,8 +794,9 @@ Logger.prototype = {
|
|||
name += ".chat";
|
||||
return this.getLogsForAccountAndName(aConversation.account, name, aGroupByDay);
|
||||
},
|
||||
getSystemLogsForAccount: function logger_getSystemLogsForAccount(aAccount)
|
||||
this.getLogsForAccountAndName(aAccount, ".system"),
|
||||
getSystemLogsForAccount: function logger_getSystemLogsForAccount(aAccount) {
|
||||
return this.getLogsForAccountAndName(aAccount, ".system");
|
||||
},
|
||||
getSimilarLogs: Task.async(function* (aLog, aGroupByDay) {
|
||||
let iterator = new OS.File.DirectoryIterator(OS.Path.dirname(aLog.path));
|
||||
let entries;
|
||||
|
|
|
@ -36,7 +36,7 @@ smileProtocolHandler.prototype = {
|
|||
channel.originalURI = aURI;
|
||||
return channel;
|
||||
},
|
||||
allowPort: function SPH_allowPort(aPort, aScheme) false,
|
||||
allowPort: function SPH_allowPort(aPort, aScheme) { return false; },
|
||||
|
||||
classDescription: "Smile Protocol Handler",
|
||||
classID: Components.ID("{04e58eae-dfbc-4c9e-8130-6d9ef19cbff4}"),
|
||||
|
|
|
@ -32,7 +32,7 @@ function fakeCommand(aName, aUsageContext) {
|
|||
this.usageContext = aUsageContext;
|
||||
}
|
||||
fakeCommand.prototype = {
|
||||
get helpString() "",
|
||||
get helpString() { return ""; },
|
||||
usageContext: Ci.imICommand.CMD_CONTEXT_ALL,
|
||||
priority: Ci.imICommand.CMD_PRIORITY_PRPL,
|
||||
run: (aMsg, aConv) => true
|
||||
|
|
|
@ -41,8 +41,8 @@ let dummyConv = {
|
|||
id: 0,
|
||||
title: "dummy conv",
|
||||
normalizedName: "dummyconv",
|
||||
get name() this.normalizedName,
|
||||
get startDate() new Date(2011, 5, 28).valueOf() * 1000,
|
||||
get name() { return this.normalizedName; },
|
||||
get startDate() { return new Date(2011, 5, 28).valueOf() * 1000; },
|
||||
isChat: false
|
||||
};
|
||||
|
||||
|
@ -52,8 +52,8 @@ let dummyConv2 = {
|
|||
id: 0,
|
||||
title: "dummy conv",
|
||||
normalizedName: "dummyconv",
|
||||
get name() this.normalizedName,
|
||||
get startDate() new Date(2011, 5, 29).valueOf() * 1000,
|
||||
get name() { return this.normalizedName; },
|
||||
get startDate() { return new Date(2011, 5, 29).valueOf() * 1000; },
|
||||
isChat: false
|
||||
};
|
||||
|
||||
|
@ -62,7 +62,7 @@ let dummyMUC = {
|
|||
id: 1,
|
||||
title: "Dummy MUC",
|
||||
normalizedName: "dummymuc",
|
||||
get name() this.normalizedName,
|
||||
get name() { return this.normalizedName; },
|
||||
startDate: new Date(2011, 5, 28).valueOf() * 1000,
|
||||
isChat: true
|
||||
};
|
||||
|
@ -72,7 +72,7 @@ let dummyTwitterConv = {
|
|||
id: 2,
|
||||
title: "Dummy Twitter Conv",
|
||||
normalizedName: "dummytwitterconv",
|
||||
get name() this.normalizedName,
|
||||
get name() { return this.normalizedName; },
|
||||
startDate: new Date(2011, 5, 28).valueOf() * 1000,
|
||||
isChat: true
|
||||
};
|
||||
|
|
|
@ -692,7 +692,7 @@
|
|||
continue;
|
||||
sections.push([y, y - Math.round(this.clientHeight / 2)]);
|
||||
}
|
||||
sections.sort(function(a, b) a[0] - b[0]);
|
||||
sections.sort((a, b) => a[0] - b[0]);
|
||||
return sections;
|
||||
]]>
|
||||
</body>
|
||||
|
|
|
@ -24,7 +24,9 @@ function copyBytes(aTarget, aSource, aTargetOffset = 0, aSourceOffset = 0,
|
|||
view.set(new Uint8Array(aSource, aSourceOffset, aLength));
|
||||
}
|
||||
|
||||
function ArrayBufferToBytes(aBuf) [b for (b of new Uint8Array(aBuf))];
|
||||
function ArrayBufferToBytes(aBuf) {
|
||||
return [...new Uint8Array(aBuf)];
|
||||
}
|
||||
|
||||
function BytesToArrayBuffer(aBytes = []) {
|
||||
let buf = new ArrayBuffer(aBytes.length);
|
||||
|
@ -33,12 +35,18 @@ function BytesToArrayBuffer(aBytes = []) {
|
|||
return buf;
|
||||
}
|
||||
|
||||
function StringToBytes(aString) [aString.charCodeAt(i) for (i in aString)];
|
||||
function StringToBytes(aString) {
|
||||
return [aString.charCodeAt(i) for (i in aString)];
|
||||
}
|
||||
|
||||
function StringToArrayBuffer(aString) BytesToArrayBuffer(StringToBytes(aString))
|
||||
function StringToArrayBuffer(aString) {
|
||||
return BytesToArrayBuffer(StringToBytes(aString));
|
||||
}
|
||||
|
||||
function ArrayBufferToString(aData)
|
||||
[String.fromCharCode(b) for (b of new Uint8Array(aData))].join("");
|
||||
function ArrayBufferToString(aData) {
|
||||
return [for (b of new Uint8Array(aData)) String.fromCharCode(b)].join("");
|
||||
}
|
||||
|
||||
function ArrayBufferToHexString(aData)
|
||||
"0x" + [("0" + b.toString(16)).slice(-2) for (b of new Uint8Array(aData))].join(" ");
|
||||
function ArrayBufferToHexString(aData) {
|
||||
return "0x" + [for (b of new Uint8Array(aData)) ("0" + b.toString(16)).slice(-2)].join(" ");
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@ const EXPORTED_SYMBOLS = ["getHiddenHTMLWindow"];
|
|||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "hiddenWindow", function()
|
||||
XPCOMUtils.defineLazyGetter(this, "hiddenWindow", () =>
|
||||
Services.appShell.hiddenDOMWindow
|
||||
);
|
||||
#ifndef XP_MACOSX
|
||||
function getHiddenHTMLWindow() hiddenWindow
|
||||
function getHiddenHTMLWindow() { return hiddenWindow; }
|
||||
#else
|
||||
function getHiddenHTMLWindow() {
|
||||
let browser = hiddenWindow.document.getElementById("hiddenBrowser");
|
||||
|
|
|
@ -33,7 +33,7 @@ const EXPORTED_SYMBOLS = [
|
|||
*
|
||||
* each attribute can have a function returning a boolean indicating if
|
||||
* the attribute is accepted.
|
||||
* example: 'href': function(aValue) aValue == 'about:blank'
|
||||
* example: 'href': aValue => aValue == 'about:blank'
|
||||
*
|
||||
* - styles: an object with the allowed CSS style rule.
|
||||
* example: 'font-size': true
|
||||
|
@ -42,10 +42,10 @@ const EXPORTED_SYMBOLS = [
|
|||
* See the 3 examples of rulesets below.
|
||||
*/
|
||||
|
||||
const kAllowedURLs = function(aValue) /^(https?|ftp|mailto):/.test(aValue);
|
||||
const kAllowedURLs = aValue => /^(https?|ftp|mailto):/.test(aValue);
|
||||
const kAllowedMozClasses =
|
||||
function(aClassName) aClassName == "moz-txt-underscore" ||
|
||||
aClassName == "moz-txt-tag";
|
||||
aClassName => aClassName == "moz-txt-underscore" ||
|
||||
aClassName == "moz-txt-tag";
|
||||
|
||||
/* Tags whose content should be fully removed, and reported in the Error Console. */
|
||||
const kForbiddenTags = {
|
||||
|
|
|
@ -124,7 +124,7 @@ function getRegexp()
|
|||
let exp = /[[\]{}()*+?.\\^$|]/g;
|
||||
emoticonList = emoticonList.sort()
|
||||
.reverse()
|
||||
.map(function(x) x.replace(exp, "\\$&"));
|
||||
.map(x => x.replace(exp, "\\$&"));
|
||||
|
||||
if (!emoticonList.length) {
|
||||
// the theme contains no valid emoticon, make sure we will return
|
||||
|
|
|
@ -9,7 +9,7 @@ const {interfaces: Ci, utils: Cu} = Components;
|
|||
Cu.import("resource:///modules/imXPCOMUtils.jsm");
|
||||
Cu.import("resource:///modules/imServices.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "_", function()
|
||||
XPCOMUtils.defineLazyGetter(this, "_", () =>
|
||||
l10nHelper("chrome://chat/locale/status.properties")
|
||||
);
|
||||
|
||||
|
@ -25,7 +25,7 @@ statusAttributes[imIStatusInfo.STATUS_UNAVAILABLE] = "unavailable";
|
|||
statusAttributes[imIStatusInfo.STATUS_AVAILABLE] = "available";
|
||||
|
||||
const Status = {
|
||||
toAttribute: function(aStatusType)
|
||||
toAttribute: aStatusType =>
|
||||
aStatusType in statusAttributes ? statusAttributes[aStatusType] : "unknown",
|
||||
|
||||
_labels: {},
|
||||
|
|
|
@ -32,13 +32,13 @@ const DEFAULT_THEMES = ["bubbles", "dark", "papersheets", "simple"];
|
|||
|
||||
const kLineBreak = "@mozilla.org/windows-registry-key;1" in Cc ? "\r\n" : "\n";
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gPrefBranch", function()
|
||||
XPCOMUtils.defineLazyGetter(this, "gPrefBranch", () =>
|
||||
Services.prefs.getBranch(kMessagesStylePrefBranch)
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "TXTToHTML", function() {
|
||||
let cs = Cc["@mozilla.org/txttohtmlconv;1"].getService(Ci.mozITXTToHTMLConv);
|
||||
return function(aTXT) cs.scanTXT(aTXT, cs.kEntities);
|
||||
return aTXT => cs.scanTXT(aTXT, cs.kEntities);
|
||||
});
|
||||
|
||||
var gCurrentTheme = null;
|
||||
|
@ -93,20 +93,20 @@ function HTMLTheme(aBaseURI)
|
|||
}
|
||||
|
||||
HTMLTheme.prototype = {
|
||||
get footer() "",
|
||||
get header() "",
|
||||
get status() this.incomingContent,
|
||||
get statusNext() this.status,
|
||||
get footer() { return ""; },
|
||||
get header() { return ""; },
|
||||
get status() { return this.incomingContent; },
|
||||
get statusNext() { return this.status; },
|
||||
get incomingContent() {
|
||||
throw "Incoming/Content.html is a required file";
|
||||
},
|
||||
get incomingNextContent() this.incomingContent,
|
||||
get outgoingContent() this.incomingContent,
|
||||
get outgoingNextContent() this.incomingNextContent,
|
||||
get incomingContext() this.incomingContent,
|
||||
get incomingNextContext() this.incomingNextContent,
|
||||
get outgoingContext() this.hasOwnProperty("outgoingContent") ? this.outgoingContent : this.incomingContext,
|
||||
get outgoingNextContext() this.hasOwnProperty("outgoingNextContent") ? this.outgoingNextContent : this.incomingNextContext
|
||||
get incomingNextContent() { return this.incomingContent; },
|
||||
get outgoingContent() { return this.incomingContent; },
|
||||
get outgoingNextContent() { return this.incomingNextContent; },
|
||||
get incomingContext() { return this.incomingContent; },
|
||||
get incomingNextContext() { return this.incomingNextContent; },
|
||||
get outgoingContext() { return this.hasOwnProperty("outgoingContent") ? this.outgoingContent : this.incomingContext; },
|
||||
get outgoingNextContext() { return this.hasOwnProperty("outgoingNextContent") ? this.outgoingNextContent : this.incomingNextContext; }
|
||||
};
|
||||
|
||||
function plistToJSON(aElt)
|
||||
|
@ -291,8 +291,8 @@ function getDirectoryEntries(aDir)
|
|||
function getThemeVariants(aTheme)
|
||||
{
|
||||
let variants = getDirectoryEntries(aTheme.baseURI + "Variants/");
|
||||
return variants.filter(function(v) v.endsWith(".css"))
|
||||
.map(function(v) v.substring(0, v.length - 4));
|
||||
return variants.filter(v => v.endsWith(".css"))
|
||||
.map(v => v.substring(0, v.length - 4));
|
||||
}
|
||||
|
||||
/* helper function for replacements in messages */
|
||||
|
@ -325,16 +325,16 @@ function getStatusIconFromBuddy(aBuddy)
|
|||
}
|
||||
|
||||
const headerFooterReplacements = {
|
||||
chatName: function(aConv) TXTToHTML(aConv.title),
|
||||
sourceName: function(aConv) TXTToHTML(aConv.account.alias || aConv.account.name),
|
||||
destinationName: function(aConv) TXTToHTML(aConv.name),
|
||||
destinationDisplayName: function(aConv) TXTToHTML(aConv.title),
|
||||
chatName: aConv => TXTToHTML(aConv.title),
|
||||
sourceName: aConv => TXTToHTML(aConv.account.alias || aConv.account.name),
|
||||
destinationName: aConv => TXTToHTML(aConv.name),
|
||||
destinationDisplayName: aConv => TXTToHTML(aConv.title),
|
||||
incomingIconPath: function(aConv) {
|
||||
let buddy;
|
||||
return (!aConv.isChat && (buddy = aConv.buddy) &&
|
||||
buddy.buddyIconFilename) || "incoming_icon.png";
|
||||
},
|
||||
outgoingIconPath: function(aConv) "outgoing_icon.png",
|
||||
outgoingIconPath: aConv => "outgoing_icon.png",
|
||||
timeOpened: function(aConv, aFormat) {
|
||||
let date = new Date(aConv.startDate / 1000);
|
||||
if (aFormat)
|
||||
|
@ -344,23 +344,24 @@ const headerFooterReplacements = {
|
|||
}
|
||||
};
|
||||
|
||||
function formatAutoResponce(aTxt)
|
||||
Services.strings
|
||||
.createBundle("chrome://chat/locale/conversations.properties")
|
||||
.formatStringFromName("autoReply", [aTxt], 1)
|
||||
function formatAutoResponce(aTxt) {
|
||||
return Services.strings
|
||||
.createBundle("chrome://chat/locale/conversations.properties")
|
||||
.formatStringFromName("autoReply", [aTxt], 1);
|
||||
}
|
||||
|
||||
const statusMessageReplacements = {
|
||||
message: function(aMsg) "<span class=\"ib-msg-txt\">" +
|
||||
(aMsg.autoResponse ? formatAutoResponce(aMsg.message) : aMsg.message) +
|
||||
"</span>",
|
||||
message: aMsg => "<span class=\"ib-msg-txt\">" +
|
||||
(aMsg.autoResponse ? formatAutoResponce(aMsg.message) : aMsg.message) +
|
||||
"</span>",
|
||||
time: function(aMsg, aFormat) {
|
||||
let date = new Date(aMsg.time * 1000);
|
||||
if (aFormat)
|
||||
return date.toLocaleFormat(aFormat);
|
||||
return date.toLocaleTimeString();
|
||||
},
|
||||
timestamp: function(aMsg) aMsg.time,
|
||||
shortTime: function(aMsg) (new Date(aMsg.time * 1000)).toLocaleTimeString(),
|
||||
timestamp: aMsg => aMsg.time,
|
||||
shortTime: aMsg => (new Date(aMsg.time * 1000)).toLocaleTimeString(),
|
||||
messageClasses: function(aMsg) {
|
||||
let msgClass = [];
|
||||
|
||||
|
@ -396,8 +397,9 @@ const statusMessageReplacements = {
|
|||
}
|
||||
};
|
||||
|
||||
function formatSender(aName)
|
||||
"<span class=\"ib-sender\">" + TXTToHTML(aName) + "</span>";
|
||||
function formatSender(aName) {
|
||||
return "<span class=\"ib-sender\">" + TXTToHTML(aName) + "</span>";
|
||||
}
|
||||
const messageReplacements = {
|
||||
userIconPath: function (aMsg) {
|
||||
// If the protocol plugin provides an icon for the message, use it.
|
||||
|
@ -415,22 +417,21 @@ const messageReplacements = {
|
|||
// Fallback to the theme's default icons.
|
||||
return (aMsg.incoming ? "Incoming" : "Outgoing") + "/buddy_icon.png";
|
||||
},
|
||||
senderScreenName: function(aMsg) formatSender(aMsg.who),
|
||||
sender: function(aMsg) formatSender(aMsg.alias || aMsg.who),
|
||||
senderColor: function(aMsg) aMsg.color,
|
||||
senderStatusIcon: function(aMsg)
|
||||
getStatusIconFromBuddy(getBuddyFromMessage(aMsg)),
|
||||
messageDirection: function(aMsg) "ltr",
|
||||
senderScreenName: aMsg => formatSender(aMsg.who),
|
||||
sender: aMsg => formatSender(aMsg.alias || aMsg.who),
|
||||
senderColor: aMsg => aMsg.color,
|
||||
senderStatusIcon: aMsg => getStatusIconFromBuddy(getBuddyFromMessage(aMsg)),
|
||||
messageDirection: aMsg => "ltr",
|
||||
// no theme actually use this, don't bother making sure this is the real
|
||||
// serverside alias
|
||||
senderDisplayName: function(aMsg) formatSender(aMsg.alias || aMsg.who),
|
||||
service: function(aMsg) aMsg.conversation.account.protocol.name,
|
||||
textbackgroundcolor: function(aMsg, aFormat) "transparent", // FIXME?
|
||||
senderDisplayName: aMsg => formatSender(aMsg.alias || aMsg.who),
|
||||
service: aMsg => aMsg.conversation.account.protocol.name,
|
||||
textbackgroundcolor: (aMsg, aFormat) => "transparent", // FIXME?
|
||||
__proto__: statusMessageReplacements
|
||||
};
|
||||
|
||||
const statusReplacements = {
|
||||
status: function(aMsg) "", //FIXME
|
||||
status: aMsg => "", //FIXME
|
||||
statusIcon: function(aMsg) {
|
||||
let conv = aMsg.conversation;
|
||||
let buddy = null;
|
||||
|
@ -695,7 +696,7 @@ function serializeSelection(aSelection)
|
|||
// If at least one selected message has some of its text selected,
|
||||
// remove from the selection all the messages that have no text
|
||||
// selected
|
||||
let testFunction = function(msg) msg.isTextSelected();
|
||||
let testFunction = msg => msg.isTextSelected();
|
||||
if (messages.some(testFunction))
|
||||
messages = messages.filter(testFunction);
|
||||
|
||||
|
@ -753,7 +754,7 @@ function SelectedMessage(aRootNode, aRange)
|
|||
}
|
||||
|
||||
SelectedMessage.prototype = {
|
||||
get msg() this._rootNodes[0]._originalMsg,
|
||||
get msg() { return this._rootNodes[0]._originalMsg; },
|
||||
addRoot: function(aRootNode) {
|
||||
this._rootNodes.push(aRootNode);
|
||||
},
|
||||
|
@ -920,8 +921,8 @@ SelectedMessage.prototype = {
|
|||
// have to change the content of msg.message and revert it
|
||||
// afterwards.
|
||||
replacements = {
|
||||
message: function(aMsg) text,
|
||||
sender: function(aMsg) aMsg.alias || aMsg.who,
|
||||
message: aMsg => text,
|
||||
sender: aMsg => aMsg.alias || aMsg.who,
|
||||
__proto__: replacements
|
||||
};
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ XPCOMUtils.defineLazyGetter(Cu.getGlobalForObject({}), "gLogLevels", function()
|
|||
.getService(Ci.nsIEnvironment)
|
||||
.get("PRPL_LOG")
|
||||
.split(/[;,]/)
|
||||
.filter(function(n) n != "")
|
||||
.filter(n => n != "")
|
||||
.forEach(function(env) {
|
||||
let [, module, level] = env.match(/(?:(.*?)[:=])?(\d+)/);
|
||||
logLevels["level" + (module ? "." + module : "")] = parseInt(level, 10);
|
||||
|
@ -176,14 +176,14 @@ function ClassInfo(aInterfaces, aDescription = "JS Proto Object")
|
|||
Services.console.logStringMessage("ClassInfo: unknown interface " + i);
|
||||
|
||||
this._interfaces =
|
||||
aInterfaces.map(function (i) typeof i == "string" ? Ci[i] : i);
|
||||
aInterfaces.map(i => typeof i == "string" ? Ci[i] : i);
|
||||
|
||||
this.classDescription = aDescription;
|
||||
}
|
||||
ClassInfo.prototype = {
|
||||
QueryInterface: function ClassInfo_QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsISupports) || iid.equals(Ci.nsIClassInfo) ||
|
||||
this._interfaces.some(function(i) i.equals(iid)))
|
||||
this._interfaces.some(i => i.equals(iid)))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
|
@ -194,7 +194,7 @@ ClassInfo.prototype = {
|
|||
countRef.value = interfaces.length;
|
||||
return interfaces;
|
||||
},
|
||||
getHelperForLanguage: function(language) null,
|
||||
getHelperForLanguage: language => null,
|
||||
contractID: null,
|
||||
classID: null,
|
||||
implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
|
||||
|
@ -232,7 +232,7 @@ function nsSimpleEnumerator(items)
|
|||
this._nextIndex = 0;
|
||||
}
|
||||
nsSimpleEnumerator.prototype = {
|
||||
hasMoreElements: function() this._nextIndex < this._items.length,
|
||||
hasMoreElements: function() { return this._nextIndex < this._items.length; },
|
||||
getNext: function() {
|
||||
if (!this.hasMoreElements())
|
||||
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
||||
|
@ -243,7 +243,7 @@ nsSimpleEnumerator.prototype = {
|
|||
};
|
||||
|
||||
const EmptyEnumerator = {
|
||||
hasMoreElements: function() false,
|
||||
hasMoreElements: () => false,
|
||||
getNext: function() { throw Cr.NS_ERROR_NOT_AVAILABLE; },
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISimpleEnumerator])
|
||||
};
|
||||
|
|
|
@ -20,13 +20,13 @@ const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
|
|||
Cu.import("resource:///modules/imXPCOMUtils.jsm");
|
||||
Cu.import("resource:///modules/imServices.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "_", function()
|
||||
XPCOMUtils.defineLazyGetter(this, "_", () =>
|
||||
l10nHelper("chrome://chat/locale/conversations.properties")
|
||||
);
|
||||
|
||||
const GenericAccountPrototype = {
|
||||
__proto__: ClassInfo("prplIAccount", "generic account object"),
|
||||
get wrappedJSObject() this,
|
||||
get wrappedJSObject() { return this; },
|
||||
_init: function _init(aProtocol, aImAccount) {
|
||||
this.protocol = aProtocol;
|
||||
this.imAccount = aImAccount;
|
||||
|
@ -43,13 +43,13 @@ const GenericAccountPrototype = {
|
|||
setInt: function(aName, aVal) {},
|
||||
setString: function(aName, aVal) {},
|
||||
|
||||
get name() this.imAccount.name,
|
||||
get connected() this.imAccount.connected,
|
||||
get connecting() this.imAccount.connecting,
|
||||
get disconnected() this.imAccount.disconnected,
|
||||
get disconnecting() this.imAccount.disconnecting,
|
||||
get name() { return this.imAccount.name; },
|
||||
get connected() { return this.imAccount.connected; },
|
||||
get connecting() { return this.imAccount.connecting; },
|
||||
get disconnected() { return this.imAccount.disconnected; },
|
||||
get disconnecting() { return this.imAccount.disconnecting; },
|
||||
_connectionErrorReason: Ci.prplIAccount.NO_ERROR,
|
||||
get connectionErrorReason() this._connectionErrorReason,
|
||||
get connectionErrorReason() { return this._connectionErrorReason; },
|
||||
|
||||
/*
|
||||
* Convert a socket's nsISSLStatus into a prplIAccount connection error. Store
|
||||
|
@ -88,9 +88,9 @@ const GenericAccountPrototype = {
|
|||
return Ci.prplIAccount.ERROR_CERT_OTHER_ERROR;
|
||||
},
|
||||
_connectionTarget: "",
|
||||
get connectionTarget() this._connectionTarget,
|
||||
get connectionTarget() { return this._connectionTarget; },
|
||||
_sslStatus: null,
|
||||
get sslStatus() this._sslStatus,
|
||||
get sslStatus() { return this._sslStatus; },
|
||||
|
||||
reportConnected: function() {
|
||||
this.imAccount.observe(this, "account-connected", null);
|
||||
|
@ -134,8 +134,8 @@ const GenericAccountPrototype = {
|
|||
if (!this._pendingBuddyRequests)
|
||||
this._pendingBuddyRequests = [];
|
||||
let buddyRequest = {
|
||||
get account() this._account.imAccount,
|
||||
get userName() aUserName,
|
||||
get account() { return this._account.imAccount; },
|
||||
get userName() { return aUserName; },
|
||||
_account: this,
|
||||
// Grant and deny callbacks both receive the auth request object as an
|
||||
// argument for further use.
|
||||
|
@ -167,7 +167,7 @@ const GenericAccountPrototype = {
|
|||
return;
|
||||
|
||||
this._pendingBuddyRequests =
|
||||
this._pendingBuddyRequests.filter(function(r) r !== aRequest);
|
||||
this._pendingBuddyRequests.filter(r => r !== aRequest);
|
||||
},
|
||||
cancelPendingBuddyRequests: function() {
|
||||
if (!this._pendingBuddyRequests)
|
||||
|
@ -180,7 +180,7 @@ const GenericAccountPrototype = {
|
|||
|
||||
requestBuddyInfo: function(aBuddyName) {},
|
||||
|
||||
get canJoinChat() false,
|
||||
get canJoinChat() { return false; },
|
||||
getChatRoomFields: function() {
|
||||
if (!this.chatRoomFields)
|
||||
return EmptyEnumerator;
|
||||
|
@ -207,47 +207,50 @@ const GenericAccountPrototype = {
|
|||
return new ChatRoomFieldValues(defaultFieldValues);
|
||||
},
|
||||
requestRoomInfo: function(aCallback) { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
get isRoomInfoStale() false,
|
||||
get isRoomInfoStale() { return false; },
|
||||
|
||||
getPref: function (aName, aType)
|
||||
this.prefs.prefHasUserValue(aName) ?
|
||||
this.prefs["get" + aType + "Pref"](aName) :
|
||||
this.protocol._getOptionDefault(aName),
|
||||
getInt: function(aName) this.getPref(aName, "Int"),
|
||||
getBool: function(aName) this.getPref(aName, "Bool"),
|
||||
getPref: function (aName, aType) {
|
||||
return this.prefs.prefHasUserValue(aName) ?
|
||||
this.prefs["get" + aType + "Pref"](aName) :
|
||||
this.protocol._getOptionDefault(aName);
|
||||
},
|
||||
getInt: function(aName) { return this.getPref(aName, "Int"); },
|
||||
getBool: function(aName) { return this.getPref(aName, "Bool"); },
|
||||
getString: function(aName) {
|
||||
return this.prefs.prefHasUserValue(aName) ?
|
||||
this.prefs.getComplexValue(aName, Ci.nsISupportsString).data :
|
||||
this.protocol._getOptionDefault(aName);
|
||||
},
|
||||
|
||||
get prefs() this._prefs ||
|
||||
(this._prefs = Services.prefs.getBranch("messenger.account." +
|
||||
this.imAccount.id + ".options.")),
|
||||
get prefs() {
|
||||
return this._prefs ||
|
||||
(this._prefs = Services.prefs.getBranch("messenger.account." +
|
||||
this.imAccount.id + ".options."));
|
||||
},
|
||||
|
||||
get normalizedName() this.normalize(this.name),
|
||||
normalize: function(aName) aName.toLowerCase(),
|
||||
get normalizedName() { return this.normalize(this.name); },
|
||||
normalize: function(aName) { return aName.toLowerCase(); },
|
||||
|
||||
get proxyInfo() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
set proxyInfo(val) { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
get HTMLEnabled() false,
|
||||
get HTMLEscapePlainText() false,
|
||||
get noBackgroundColors() true,
|
||||
get autoResponses() false,
|
||||
get singleFormatting() false,
|
||||
get noFontSizes() false,
|
||||
get noUrlDesc() false,
|
||||
get noImages() true
|
||||
get HTMLEnabled() { return false; },
|
||||
get HTMLEscapePlainText() { return false; },
|
||||
get noBackgroundColors() { return true; },
|
||||
get autoResponses() { return false; },
|
||||
get singleFormatting() { return false; },
|
||||
get noFontSizes() { return false; },
|
||||
get noUrlDesc() { return false; },
|
||||
get noImages() { return true; }
|
||||
};
|
||||
|
||||
|
||||
const GenericAccountBuddyPrototype = {
|
||||
__proto__: ClassInfo("prplIAccountBuddy", "generic account buddy object"),
|
||||
get DEBUG() this._account.DEBUG,
|
||||
get LOG() this._account.LOG,
|
||||
get WARN() this._account.WARN,
|
||||
get ERROR() this._account.ERROR,
|
||||
get DEBUG() { return this._account.DEBUG; },
|
||||
get LOG() { return this._account.LOG; },
|
||||
get WARN() { return this._account.WARN; },
|
||||
get ERROR() { return this._account.ERROR; },
|
||||
|
||||
_init: function(aAccount, aBuddy, aTag, aUserName) {
|
||||
if (!aBuddy && !aUserName)
|
||||
|
@ -269,14 +272,14 @@ const GenericAccountBuddyPrototype = {
|
|||
delete this._buddy;
|
||||
},
|
||||
|
||||
get account() this._account.imAccount,
|
||||
get account() { return this._account.imAccount; },
|
||||
set buddy(aBuddy) {
|
||||
if (this._buddy)
|
||||
throw Cr.NS_ERROR_ALREADY_INITIALIZED;
|
||||
this._buddy = aBuddy;
|
||||
},
|
||||
get buddy() this._buddy,
|
||||
get tag() this._tag,
|
||||
get buddy() { return this._buddy; },
|
||||
get tag() { return this._tag; },
|
||||
set tag(aNewTag) {
|
||||
let oldTag = this._tag;
|
||||
this._tag = aNewTag;
|
||||
|
@ -292,10 +295,10 @@ const GenericAccountBuddyPrototype = {
|
|||
},
|
||||
|
||||
_userName: "",
|
||||
get userName() this._userName || this._buddy.userName,
|
||||
get normalizedName() this._account.normalize(this.userName),
|
||||
get userName() { return this._userName || this._buddy.userName; },
|
||||
get normalizedName() { return this._account.normalize(this.userName); },
|
||||
_serverAlias: "",
|
||||
get serverAlias() this._serverAlias,
|
||||
get serverAlias() { return this._serverAlias; },
|
||||
set serverAlias(aNewAlias) {
|
||||
let old = this.displayName;
|
||||
this._serverAlias = aNewAlias;
|
||||
|
@ -308,21 +311,21 @@ const GenericAccountBuddyPrototype = {
|
|||
},
|
||||
|
||||
// imIStatusInfo implementation
|
||||
get displayName() this.serverAlias || this.userName,
|
||||
get displayName() { return this.serverAlias || this.userName; },
|
||||
_buddyIconFileName: "",
|
||||
get buddyIconFilename() this._buddyIconFileName,
|
||||
get buddyIconFilename() { return this._buddyIconFileName; },
|
||||
set buddyIconFilename(aNewFileName) {
|
||||
this._buddyIconFileName = aNewFileName;
|
||||
this._notifyObservers("icon-changed");
|
||||
},
|
||||
_statusType: 0,
|
||||
get statusType() this._statusType,
|
||||
get online() this._statusType > Ci.imIStatusInfo.STATUS_OFFLINE,
|
||||
get available() this._statusType == Ci.imIStatusInfo.STATUS_AVAILABLE,
|
||||
get idle() this._statusType == Ci.imIStatusInfo.STATUS_IDLE,
|
||||
get mobile() this._statusType == Ci.imIStatusInfo.STATUS_MOBILE,
|
||||
get statusType() { return this._statusType; },
|
||||
get online() { return this._statusType > Ci.imIStatusInfo.STATUS_OFFLINE; },
|
||||
get available() { return this._statusType == Ci.imIStatusInfo.STATUS_AVAILABLE; },
|
||||
get idle() { return this._statusType == Ci.imIStatusInfo.STATUS_IDLE; },
|
||||
get mobile() { return this._statusType == Ci.imIStatusInfo.STATUS_MOBILE; },
|
||||
_statusText: "",
|
||||
get statusText() this._statusText,
|
||||
get statusText() { return this._statusText; },
|
||||
|
||||
// This is for use by the protocol plugin, it's not exposed in the
|
||||
// imIStatusInfo interface.
|
||||
|
@ -362,11 +365,11 @@ const GenericAccountBuddyPrototype = {
|
|||
},
|
||||
|
||||
_availabilityDetails: 0,
|
||||
get availabilityDetails() this._availabilityDetails,
|
||||
get availabilityDetails() { return this._availabilityDetails; },
|
||||
|
||||
get canSendMessage() this.online /*|| this.account.canSendOfflineMessage(this) */,
|
||||
get canSendMessage() { return this.online /*|| this.account.canSendOfflineMessage(this) */; },
|
||||
|
||||
getTooltipInfo: function() EmptyEnumerator,
|
||||
getTooltipInfo: () => EmptyEnumerator,
|
||||
createConversation: function() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; }
|
||||
};
|
||||
|
||||
|
@ -392,7 +395,7 @@ const GenericMessagePrototype = {
|
|||
this[i] = aObject[i];
|
||||
},
|
||||
_alias: "",
|
||||
get alias() this._alias || this.who,
|
||||
get alias() { return this._alias || this.who; },
|
||||
_iconURL: "",
|
||||
get iconURL() {
|
||||
// If the protocol plugin has explicitly set an icon for the message, use it.
|
||||
|
@ -408,7 +411,7 @@ const GenericMessagePrototype = {
|
|||
return "";
|
||||
},
|
||||
_conversation: null,
|
||||
get conversation() this._conversation,
|
||||
get conversation() { return this._conversation; },
|
||||
set conversation(aConv) {
|
||||
this._conversation = aConv;
|
||||
aConv.notifyObservers(this, "new-text", null);
|
||||
|
@ -442,12 +445,12 @@ Message.prototype = GenericMessagePrototype;
|
|||
|
||||
const GenericConversationPrototype = {
|
||||
__proto__: ClassInfo("prplIConversation", "generic conversation object"),
|
||||
get wrappedJSObject() this,
|
||||
get wrappedJSObject() { return this; },
|
||||
|
||||
get DEBUG() this._account.DEBUG,
|
||||
get LOG() this._account.LOG,
|
||||
get WARN() this._account.WARN,
|
||||
get ERROR() this._account.ERROR,
|
||||
get DEBUG() { return this._account.DEBUG; },
|
||||
get LOG() { return this._account.LOG; },
|
||||
get WARN() { return this._account.WARN; },
|
||||
get ERROR() { return this._account.ERROR; },
|
||||
|
||||
_init: function(aAccount, aName) {
|
||||
this._account = aAccount;
|
||||
|
@ -458,7 +461,7 @@ const GenericConversationPrototype = {
|
|||
},
|
||||
|
||||
_id: 0,
|
||||
get id() this._id,
|
||||
get id() { return this._id; },
|
||||
set id(aId) {
|
||||
if (this._id)
|
||||
throw Cr.NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
@ -470,7 +473,7 @@ const GenericConversationPrototype = {
|
|||
this._observers.push(aObserver);
|
||||
},
|
||||
removeObserver: function(aObserver) {
|
||||
this._observers = this._observers.filter(function(o) o !== aObserver);
|
||||
this._observers = this._observers.filter(o => o !== aObserver);
|
||||
},
|
||||
notifyObservers: function(aSubject, aTopic, aData) {
|
||||
for each (let observer in this._observers) {
|
||||
|
@ -482,7 +485,7 @@ const GenericConversationPrototype = {
|
|||
}
|
||||
},
|
||||
|
||||
prepareForSending: function(aOutgoingMessage, aCount) null,
|
||||
prepareForSending: (aOutgoingMessage, aCount) => null,
|
||||
prepareForDisplaying: function(aImMessage) {
|
||||
if (aImMessage.displayMessage !== aImMessage.message) {
|
||||
this.DEBUG("Preparing:\n" + aImMessage.message + "\nDisplaying:\n" +
|
||||
|
@ -492,7 +495,7 @@ const GenericConversationPrototype = {
|
|||
sendMsg: function(aMsg) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
sendTyping: function(aString) Ci.prplIConversation.NO_TYPING_LIMIT,
|
||||
sendTyping: aString => Ci.prplIConversation.NO_TYPING_LIMIT,
|
||||
|
||||
close: function() {
|
||||
Services.obs.notifyObservers(this, "closing-conversation", null);
|
||||
|
@ -507,11 +510,11 @@ const GenericConversationPrototype = {
|
|||
(new Message(aWho, aText, aProperties)).conversation = this;
|
||||
},
|
||||
|
||||
get account() this._account.imAccount,
|
||||
get name() this._name,
|
||||
get normalizedName() this._account.normalize(this.name),
|
||||
get title() this.name,
|
||||
get startDate() this._date
|
||||
get account() { return this._account.imAccount; },
|
||||
get name() { return this._name; },
|
||||
get normalizedName() { return this._account.normalize(this.name); },
|
||||
get title() { return this.name; },
|
||||
get startDate() { return this._date; }
|
||||
};
|
||||
|
||||
const GenericConvIMPrototype = {
|
||||
|
@ -530,7 +533,7 @@ const GenericConvIMPrototype = {
|
|||
this.notifyObservers(null, "update-typing", aName);
|
||||
},
|
||||
|
||||
get isChat() false,
|
||||
get isChat() { return false; },
|
||||
buddy: null,
|
||||
typingState: Ci.prplIConvIM.NOT_TYPING
|
||||
};
|
||||
|
@ -546,7 +549,7 @@ const GenericConvChatPrototype = {
|
|||
GenericConversationPrototype._init.call(this, aAccount, aName);
|
||||
},
|
||||
|
||||
get isChat() true,
|
||||
get isChat() { return true; },
|
||||
|
||||
// Stores the prplIChatRoomFieldValues required to join this channel
|
||||
// to enable later reconnections. If null, the MUC will not be reconnected
|
||||
|
@ -555,9 +558,9 @@ const GenericConvChatPrototype = {
|
|||
|
||||
_topic: "",
|
||||
_topicSetter: null,
|
||||
get topic() this._topic,
|
||||
get topicSettable() false,
|
||||
get topicSetter() this._topicSetter,
|
||||
get topic() { return this._topic; },
|
||||
get topicSettable() { return false; },
|
||||
get topicSetter() { return this._topicSetter; },
|
||||
setTopic: function(aTopic, aTopicSetter, aQuiet) {
|
||||
// Only change the topic if the topic and/or topic setter has changed.
|
||||
if (this._topic == aTopic &&
|
||||
|
@ -590,7 +593,7 @@ const GenericConvChatPrototype = {
|
|||
this.writeMessage(aTopicSetter, message, {system: true});
|
||||
},
|
||||
|
||||
get nick() this._nick,
|
||||
get nick() { return this._nick; },
|
||||
set nick(aNick) {
|
||||
this._nick = aNick;
|
||||
let escapedNick = this._nick.replace(/[[\]{}()*+?.\\^$|]/g, "\\$&");
|
||||
|
@ -598,7 +601,7 @@ const GenericConvChatPrototype = {
|
|||
},
|
||||
|
||||
_left: false,
|
||||
get left() this._left,
|
||||
get left() { return this._left; },
|
||||
set left(aLeft) {
|
||||
if (aLeft == this._left)
|
||||
return;
|
||||
|
@ -607,7 +610,7 @@ const GenericConvChatPrototype = {
|
|||
},
|
||||
|
||||
_joining: false,
|
||||
get joining() this._joining,
|
||||
get joining() { return this._joining; },
|
||||
set joining(aJoining) {
|
||||
if (aJoining == this._joining)
|
||||
return;
|
||||
|
@ -621,7 +624,7 @@ const GenericConvChatPrototype = {
|
|||
[participant for (participant of this._participants.values())]
|
||||
);
|
||||
},
|
||||
getNormalizedChatBuddyName: function(aChatBuddyName) aChatBuddyName,
|
||||
getNormalizedChatBuddyName: aChatBuddyName => aChatBuddyName,
|
||||
|
||||
writeMessage: function (aWho, aText, aProperties) {
|
||||
aProperties.containsNick =
|
||||
|
@ -634,12 +637,14 @@ const GenericConvChatBuddyPrototype = {
|
|||
__proto__: ClassInfo("prplIConvChatBuddy", "generic ConvChatBuddy object"),
|
||||
|
||||
_name: "",
|
||||
get name() this._name,
|
||||
get name() { return this._name; },
|
||||
alias: "",
|
||||
buddy: false,
|
||||
|
||||
get noFlags() !(this.voiced || this.halfOp || this.op ||
|
||||
this.founder || this.typing),
|
||||
get noFlags() {
|
||||
return !(this.voiced || this.halfOp || this.op ||
|
||||
this.founder || this.typing);
|
||||
},
|
||||
voiced: false,
|
||||
halfOp: false,
|
||||
op: false,
|
||||
|
@ -710,9 +715,9 @@ purplePref.prototype = {
|
|||
masked: false,
|
||||
|
||||
// Default value
|
||||
getBool: function() this._defaultValue,
|
||||
getInt: function() this._defaultValue,
|
||||
getString: function() this._defaultValue,
|
||||
getBool: function() { return this._defaultValue; },
|
||||
getInt: function() { return this._defaultValue; },
|
||||
getString: function() { return this._defaultValue; },
|
||||
getList: function() {
|
||||
// Convert a JavaScript object map {"value 1": "label 1", ...}
|
||||
let keys = Object.keys(this._listValues);
|
||||
|
@ -720,11 +725,10 @@ purplePref.prototype = {
|
|||
return EmptyEnumerator;
|
||||
|
||||
return new nsSimpleEnumerator(
|
||||
keys.map(function(key) new purpleKeyValuePair(this[key], key),
|
||||
this._listValues)
|
||||
keys.map(key => new purpleKeyValuePair(this._listValues[key], key))
|
||||
);
|
||||
},
|
||||
getListDefault: function() this._defaultValue
|
||||
getListDefault: function() { return this._defaultValue; }
|
||||
};
|
||||
|
||||
function purpleKeyValuePair(aName, aValue) {
|
||||
|
@ -740,10 +744,10 @@ function UsernameSplit(aValues) {
|
|||
UsernameSplit.prototype = {
|
||||
__proto__: ClassInfo("prplIUsernameSplit", "username split object"),
|
||||
|
||||
get label() this._values.label,
|
||||
get separator() this._values.separator,
|
||||
get defaultValue() this._values.defaultValue,
|
||||
get reverse() !!this._values.reverse // Ensure boolean
|
||||
get label() { return this._values.label; },
|
||||
get separator() { return this._values.separator; },
|
||||
get defaultValue() { return this._values.defaultValue; },
|
||||
get reverse() { return !!this._values.reverse; } // Ensure boolean
|
||||
};
|
||||
|
||||
function ChatRoomField(aIdentifier, aField) {
|
||||
|
@ -770,8 +774,9 @@ function ChatRoomFieldValues(aMap) {
|
|||
ChatRoomFieldValues.prototype = {
|
||||
__proto__: ClassInfo("prplIChatRoomFieldValues", "ChatRoomFieldValues"),
|
||||
|
||||
getValue: function(aIdentifier)
|
||||
this.values.hasOwnProperty(aIdentifier) ? this.values[aIdentifier] : null,
|
||||
getValue: function(aIdentifier) {
|
||||
return this.values.hasOwnProperty(aIdentifier) ? this.values[aIdentifier] : null;
|
||||
},
|
||||
setValue: function(aIdentifier, aValue) {
|
||||
this.values[aIdentifier] = aValue;
|
||||
}
|
||||
|
@ -786,11 +791,11 @@ const GenericProtocolPrototype = {
|
|||
if (aId != this.id)
|
||||
throw "Creating an instance of " + aId + " but this object implements " + this.id;
|
||||
},
|
||||
get id() "prpl-" + this.normalizedName,
|
||||
get id() { return "prpl-" + this.normalizedName; },
|
||||
// This is more aggressive than the account normalization of just
|
||||
// toLowerCase() since prpl names must be only letters/numbers.
|
||||
get normalizedName() this.name.replace(/[^a-z0-9]/gi, "").toLowerCase(),
|
||||
get iconBaseURI() "chrome://chat/skin/prpl-generic/",
|
||||
get normalizedName() { return this.name.replace(/[^a-z0-9]/gi, "").toLowerCase(); },
|
||||
get iconBaseURI() { return "chrome://chat/skin/prpl-generic/"; },
|
||||
|
||||
getAccount: function(aImAccount) { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
||||
|
@ -813,7 +818,7 @@ const GenericProtocolPrototype = {
|
|||
return EmptyEnumerator;
|
||||
|
||||
return new nsSimpleEnumerator(
|
||||
this.usernameSplits.map(function(split) new UsernameSplit(split)));
|
||||
this.usernameSplits.map(split => new UsernameSplit(split)));
|
||||
},
|
||||
|
||||
registerCommands: function() {
|
||||
|
@ -834,20 +839,20 @@ const GenericProtocolPrototype = {
|
|||
},
|
||||
|
||||
// NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED errors are too noisy
|
||||
get usernameEmptyText() "",
|
||||
accountExists: function() false, //FIXME
|
||||
get usernameEmptyText() { return ""; },
|
||||
accountExists: () => false, //FIXME
|
||||
|
||||
get uniqueChatName() false,
|
||||
get chatHasTopic() false,
|
||||
get noPassword() false,
|
||||
get newMailNotification() false,
|
||||
get imagesInIM() false,
|
||||
get passwordOptional() false,
|
||||
get usePointSize() true,
|
||||
get registerNoScreenName() false,
|
||||
get slashCommandsNative() false,
|
||||
get usePurpleProxy() false,
|
||||
get uniqueChatName() { return false; },
|
||||
get chatHasTopic() { return false; },
|
||||
get noPassword() { return false; },
|
||||
get newMailNotification() { return false; },
|
||||
get imagesInIM() { return false; },
|
||||
get passwordOptional() { return false; },
|
||||
get usePointSize() { return true; },
|
||||
get registerNoScreenName() { return false; },
|
||||
get slashCommandsNative() { return false; },
|
||||
get usePurpleProxy() { return false; },
|
||||
|
||||
get classDescription() this.name + " Protocol",
|
||||
get contractID() "@mozilla.org/chat/" + this.normalizedName + ";1"
|
||||
get classDescription() { return this.name + " Protocol"; },
|
||||
get contractID() { return "@mozilla.org/chat/" + this.normalizedName + ";1"; }
|
||||
};
|
||||
|
|
|
@ -675,10 +675,10 @@ const Socket = {
|
|||
Ci.nsIBadCertListener2, Ci.nsIProtocolProxyCallback],
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
this._interfaces.some(function(i) i.equals(iid)))
|
||||
this._interfaces.some(i => i.equals(iid)))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
getInterface: function(iid) this.QueryInterface(iid)
|
||||
getInterface: function(iid) { return this.QueryInterface(iid); }
|
||||
};
|
||||
|
|
|
@ -261,7 +261,7 @@ function test_addGlobalAllowedTag() {
|
|||
removeGlobalAllowedTag("hr");
|
||||
|
||||
// Allow <hr> with an src attribute taking only http(s) urls.
|
||||
addGlobalAllowedTag("hr", {src: function(aValue) /^https?:/.test(aValue)});
|
||||
addGlobalAllowedTag("hr", {src: aValue => /^https?:/.test(aValue)});
|
||||
do_check_eq("<hr src=\"http://example.com/\">",
|
||||
cleanupImMarkup("<hr src=\"http://example.com/\">"));
|
||||
do_check_eq("<hr>",
|
||||
|
@ -283,7 +283,7 @@ function test_addGlobalAllowedAttribute() {
|
|||
removeGlobalAllowedAttribute("id");
|
||||
|
||||
// Allow id only with numbers.
|
||||
addGlobalAllowedAttribute("id", function(aId) /^\d+$/.test(aId));
|
||||
addGlobalAllowedAttribute("id", aId => /^\d+$/.test(aId));
|
||||
do_check_eq("<br id=\"123\">", cleanupImMarkup("<br id=\"123\">"));
|
||||
do_check_eq("<br>", cleanupImMarkup("<br id=\"foo\">"));
|
||||
removeGlobalAllowedAttribute("id");
|
||||
|
|
Загрузка…
Ссылка в новой задаче