Bug 776901 - Land in comm-central Instantbird's changes to chat/ - 2 - Bio 1404 - Add "Your account is reconnected" system message, r=clokep,fqueze.
authoraleth <aletheia2@fastmail.fm>
Wed, 27 Jun 2012 00:07:06 +0200
changeset 13138 f26baefb54f4e16131302bc6d14b02dd4f0d61cf
parent 13137 d301f87aa1c55741ee0eae5f9e8a05a1eb366f01
child 13139 fa0ad045a7d65c45ea672095eff538ce738a97a6
push idunknown
push userunknown
push dateunknown
reviewersclokep, fqueze
bugs776901
Bug 776901 - Land in comm-central Instantbird's changes to chat/ - 2 - Bio 1404 - Add "Your account is reconnected" system message, r=clokep,fqueze.
chat/components/src/imConversations.js
chat/locales/en-US/conversations.properties
--- a/chat/components/src/imConversations.js
+++ b/chat/components/src/imConversations.js
@@ -193,16 +193,20 @@ UIConversation.prototype = {
     this.notifyObservers(this, "update-buddy-status");
 
     let msg;
     if (statusType == Ci.imIStatusInfo.STATUS_UNKNOWN)
       msg = bundle.formatStringFromName("statusUnknown", [this.title], 1);
     else {
       let status = Status.toLabel(statusType);
       let stringId = wasUnknown ? "statusChangedFromUnknown" : "statusChanged";
+      if (this._justReconnected) {
+        stringId = "statusKnown";
+        delete this._justReconnected;
+      }
       if (statusText) {
         msg = bundle.formatStringFromName(stringId + "WithStatusText",
                                           [this.title, status, statusText],
                                           3);
       }
       else
         msg = bundle.formatStringFromName(stringId, [this.title, status], 2);
     }
@@ -213,21 +217,32 @@ UIConversation.prototype = {
   disconnecting: function() {
     if (this._disconnected)
       return;
 
     this._disconnected = true;
     if (this.contact)
       return; // handled by the contact observer.
 
-    this.systemMessage(bundle.GetStringFromName("accountDisconnected"));
+    if (this.isChat && this.left)
+      this._wasLeft = true;
+    else
+      this.systemMessage(bundle.GetStringFromName("accountDisconnected"));
     this.notifyObservers(this, "update-buddy-status");
   },
   connected: function() {
-    delete this._disconnected;
+    if (this._disconnected) {
+      delete this._disconnected;
+      if (!this.isChat)
+        this._justReconnected = true;
+      else if (!this._wasLeft)
+        this.systemMessage(bundle.GetStringFromName("accountReconnected"));
+      else
+        delete this._wasLeft;
+    }
     this.notifyObservers(this, "update-buddy-status");
   },
 
   observeConv: function(aTargetId, aSubject, aTopic, aData) {
     if (aTargetId != this._currentTargetId &&
         (aTopic == "new-text" ||
          (aTopic == "update-typing" &&
           this._purpleConv[aTargetId].typingState == Ci.prplIConvIM.TYPING)))
--- a/chat/locales/en-US/conversations.properties
+++ b/chat/locales/en-US/conversations.properties
@@ -17,21 +17,28 @@ statusChanged=%1$S is now %2$S.
 #  %3$S is the status text (eg. "I'm currently away from the computer").
 statusChangedWithStatusText=%1$S is now %2$S: %3$S.
 # LOCALIZATION NOTE (statusChangedFromUnknown[WithStatusText]):
 #  special case of the previous 2 strings for when the status was
 #  previously unknown. These 2 strings should not mislead the user
 #  into thinking the person's status has just changed.
 statusChangedFromUnknown=%1$S is %2$S.
 statusChangedFromUnknownWithStatusText=%1$S is %2$S: %3$S.
-
+# LOCALIZATION NOTE (statusKnown[WithStatusText]):
+# special case of the previous 2 strings for when an account has just
+# been reconnected, so the status is now known. These 2 strings should not
+# mislead the user into thinking the person's status has just changed.
+statusKnown=Your account has been reconnected (%1$S is %2$S).
+statusKnownWithStatusText=Your account has been reconnected (%1$S is %2$S: %3$S).
 # LOCALIZATION NOTE (statusUnknown):
 #  %S is the display name of the contact.
 statusUnknown=Your account is disconnected (the status of %S is no longer known).
+
 accountDisconnected=Your account is disconnected.
+accountReconnected=Your account has been reconnected.
 
 # LOCALIZATION NOTE (autoReply):
 #  %S is replaced by the text of a message that was sent as an automatic reply.
 autoReply=Auto-reply - %S
 
 # LOCALIZATION NOTE (topicSet):
 #  %1$S is the conversation name, %2$S is the topic.
 topicSet=The topic for %1$S is: %2$S.