Bug 954787 - No user feedback when sending a message in a conversation of an offline account, r=florian.

This commit is contained in:
aleth 2012-05-05 01:24:36 +02:00
Родитель eaf7aaaabc
Коммит 71c0ca9d02
3 изменённых файлов: 37 добавлений и 5 удалений

Просмотреть файл

@ -214,9 +214,12 @@ CommandsService.prototype = {
cmdArray.push(commands[""]);
if (aConversation) {
let prplId = aConversation.account.protocol.id;
if (commands.hasOwnProperty(prplId))
cmdArray.push(commands[prplId]);
let account = aConversation.account;
if (account.connected) {
let prplId = account.protocol.id;
if (commands.hasOwnProperty(prplId))
cmdArray.push(commands[prplId]);
}
}
// Remove the commands that can't apply in this context.

Просмотреть файл

@ -281,6 +281,8 @@
if (!aMsg)
return;
let account = this._conv.account;
if (aMsg[0] == "/") {
// The /say command is used to bypass command processing
// (/say can be shortened to just /).
@ -296,7 +298,7 @@
this.resetInput();
return;
}
else if (this._conv.account.protocol.slashCommandsNative) {
else if (account.protocol.slashCommandsNative && account.connected) {
let cmd = aMsg.match(/^\/[^ ]+/);
if (cmd && cmd != "/me") {
this._conv.systemMessage(
@ -307,11 +309,25 @@
}
}
if (!account.connected) {
let errMsg;
if (Services.io.offline)
errMsg = this.bundle.GetStringFromName("networkOffline");
else if (account.statusInfo.statusType ==
Components.interfaces.imIStatusInfo.STATUS_OFFLINE)
errMsg = this.bundle.GetStringFromName("statusOffline");
else {
errMsg = this.bundle.formatStringFromName("accountDisconnected",
[account.protocol.name, account.name], 2);
}
this._conv.systemMessage(errMsg, true);
return;
}
let msg = Components.classes["@mozilla.org/txttohtmlconv;1"]
.getService(Ci.mozITXTToHTMLConv)
.scanTXT(aMsg, 0);
var account = this._conv.account;
if (account.HTMLEnabled) {
msg = msg.replace(/\n/g, "<br/>");
if (Services.prefs.getBoolPref("messenger.conversations.sendFormat")) {

Просмотреть файл

@ -96,3 +96,16 @@ logs=%S logs
#LOCALIZATION NOTE
# This is shown when an unknown command (/foo) is attempted. %S is the command.
unknownCommand=%S is not a supported command. Type /help to see the list of commands.
#LOCALIZATION NOTE
# Shown when the user attempts to send a message while the network (necko) is offline.
networkOffline=Your account is disconnected because there is no network connection.
#LOCALIZATION NOTE
# This is shown when the user attempts to send a message while the status is offline.
statusOffline=Your account is disconnected because your status is currently set to offline.
#LOCALIZATION NOTE
# This is shown when the user attempts to send a message to a disconnected account.
# %1$S is the name of the protocol of the account, %2$S the name of the account.
accountDisconnected=Your %1$S account %2$S is disconnected.