/// <summary>sends LANGUAGE command</summary>
        /// <remarks>valid in any state</remarks>
        public ImapCommandResult Language(out string selectedLanguageTag, string languageRange, params string[] languageRanges)
        {
            RejectNonConnectedState();

              if (languageRange == null)
            throw new ArgumentNullException("languageRange");
              else if (languageRange.Length == 0)
            throw new ArgumentException("language range must be non-empty string", "languageRange");

              var languageRangeArguments = new List<string>();

              languageRangeArguments.Add(languageRange);

              if (languageRanges != null) {
            for (var i = 0; i < languageRanges.Length; i++) {
              if (languageRanges[i] == null)
            throw new ArgumentNullException(string.Format("languageRanges[{0}]", i));
              else if (languageRanges[i].Length == 0)
            throw new ArgumentException("language range must be non-empty string", string.Format("languageRanges[{0}]", i));

              languageRangeArguments.Add(languageRanges[i]);
            }
              }

              selectedLanguageTag = null;

              using (var t = new LanguageTransaction(connection)) {
            t.RequestArguments["language range arguments"] = new ImapStringList(languageRangeArguments.ToArray());

            if (ProcessTransaction(t).Succeeded) {
              this.selectedLanguage = t.Result.Value.Item1[0];

              if (t.Result.Value.Item2 != null)
            this.namespaces = t.Result.Value.Item2;

              selectedLanguageTag = t.Result.Value.Item1[0];
            }

            return t.Result;
              }
        }
        /// <summary>sends LANGUAGE command</summary>
        /// <remarks>valid in any state</remarks>
        public ImapCommandResult Language(out string[] supportedLanguageTags)
        {
            RejectNonConnectedState();

              supportedLanguageTags = null;

              /*
               * RFC 5255 - Internet Message Access Protocol Internationalization
               * http://tools.ietf.org/html/rfc5255
               * 3.2. LANGUAGE Command
               *    If there aren't any arguments, the server SHOULD send an untagged
               *    LANGUAGE response listing the languages it supports.  If the server
               *    is unable to enumerate the list of languages it supports it MAY
               *    return a tagged NO response to the enumeration request.
               */
              using (var t = new LanguageTransaction(connection)) {
            if (ProcessTransaction(t).Succeeded)
              supportedLanguageTags = t.Result.Value.Item1;

            return t.Result;
              }
        }