Joshi.Utils.Imap.Imap.ParseAddressList C# (CSharp) Method

ParseAddressList() private method

Parse the address string
private ParseAddressList ( string &sBodyStruct, string &sString ) : bool
sBodyStruct string body structure
sString string address
return bool
        bool ParseAddressList(ref string sBodyStruct, ref string sString)
        {
            sString = "";

            // remove any spaces at the beginning and the end
            sBodyStruct = sBodyStruct.Trim();

            // check if this is NIL
            if (IsNilString(ref sBodyStruct))
                return true;

            // remove the opening paranthesis
            if (!FindAndRemove( ref sBodyStruct, '('))
                return false;

            // process each address
            string sAddress = "";
            while (sBodyStruct[0] == '(')
            {

                // Get each address in the list
                if (!ParseAddress(ref sBodyStruct, ref sAddress))
                {
                    return true;
                }

                // prepare the address list (as comma separated
                // list of addresses).
                if (sAddress.Length > 0)
                {
                    if (sString.Length > 0)
                        sString += ", ";
                    sString += sAddress;
                }

                sBodyStruct = sBodyStruct.Trim();
            }

            // remove the closing paranthesis
            return FindAndRemove( ref sBodyStruct, ')');
        }