/// <summary> /// Send a list of identifying characteristics to the server. /// </summary> /// <param name="identification">Values to be sent.</param> public void Identify(ImapIdentification identification) { Task.Run(() => IdentifyAsync(identification)); }
/// <summary> /// Send a list of identifying characteristics to the server. /// </summary> /// <param name="identification">Values to be sent.</param> public async Task IdentifyAsync(ImapIdentification identification) { StringBuilder identificationBuilder = new StringBuilder(Constants.SMALLSBSIZE); if (!string.IsNullOrEmpty(identification.Name)) identificationBuilder.Append("\"name\" \"" + identification.Name + "\" "); if (!string.IsNullOrEmpty(identification.Version)) identificationBuilder.Append("\"version\" \"" + identification.Version + "\" "); if (!string.IsNullOrEmpty(identification.OS)) identificationBuilder.Append("\"os\" \"" + identification.OS + "\" "); if (!string.IsNullOrEmpty(identification.OSVendor)) identificationBuilder.Append("\"os-vendor\" \"" + identification.OSVendor + "\" "); if (!string.IsNullOrEmpty(identification.Vendor)) identificationBuilder.Append("\"vendor\" \"" + identification.Vendor + "\" "); if (!string.IsNullOrEmpty(identification.SupportURL)) identificationBuilder.Append("\"support-url\" \"" + identification.SupportURL + "\" "); if (!string.IsNullOrEmpty(identification.Address)) identificationBuilder.Append("\"address\" \"" + identification.Address + "\" "); if (!string.IsNullOrEmpty(identification.Date)) identificationBuilder.Append("\"date\" \"" + identification.Date + "\" "); if (!string.IsNullOrEmpty(identification.Command)) identificationBuilder.Append("\"command\" \"" + identification.Command + "\" "); if (!string.IsNullOrEmpty(identification.Arguments)) identificationBuilder.Append("\"arguments\" \"" + identification.Arguments + "\" "); if (!string.IsNullOrEmpty(identification.Environment)) identificationBuilder.Append("\"environment\" \"" + identification.Environment + "\" "); string identificationString = identificationBuilder.ToString(); if (identificationString.Length > 0) { // Generate a unique command tag for tracking this command and its response. string commandTag = UniqueCommandTag(); await SendCommandAsync(commandTag, "ID (" + identificationString.Substring(0, identificationString.Length - 1) + ")\r\n"); string response = await ReadDataAsync(commandTag, "ID"); } }