((nsCRT::ToLower(buf[0]) =='c') && (nsCRT::ToLower(buf[1]) =='i') && (nsCRT::ToLower(buf[2]) =='d') &&
((buf[0]=='c' || buf[0]=='C') && (buf[1]=='i' || buf[1]=='I') && (buf[2]=='d' || buf[2]=='D') &&
flush_tag(MimeMultipartRelated* relobj){  int length = relobj->curtag_length;  char* buf;  int status;    if (relobj->curtag == NULL || length == 0) return 0;  status = push_tag(relobj, "", 1); /* Push on a trailing NULL. */  if (status < 0) return status;  buf = relobj->curtag;  PR_ASSERT(*buf == '<' && buf[length - 1] == '>');  while (*buf) {    char c;    char* absolute;    char* part_url;    char* ptr = buf;    char *ptr2;    PRBool isquote = PR_FALSE;    while (*ptr && *ptr != '=') ptr++;    if (*ptr == '=') {      ptr++;      if (*ptr == '"') {        isquote = PR_TRUE;        /* Take up the double quote and leading space here as well. */        /* Safe because there's a '>' at the end */        do {ptr++;} while (nsCRT::IsAsciiSpace(*ptr));      }    }    status = real_write(relobj, buf, ptr - buf);    if (status < 0) return status;    buf = ptr;    if (!*buf) break;    if (isquote)     {      ptr = mime_strnchr(buf, '"', length - (buf - relobj->curtag));    } else {      for (ptr = buf; *ptr ; ptr++) {        if (*ptr == '>' || nsCRT::IsAsciiSpace(*ptr)) break;      }      PR_ASSERT(*ptr);    }    if (!ptr || !*ptr) break;    while(buf < ptr)    {      /* ### mwelch For each word in the value string, see if         the word is a cid: URL. If so, attempt to substitute the appropriate mailbox part URL in its place.                     mscott: but that's not good enough. A given word may have a cid url inside of it such as                   with style rules for background images: url(cid:....).                        */      ptr2=buf; /* walk from the left end rightward */      while((ptr2<ptr) && (!nsCRT::IsAsciiSpace(*ptr2)))        ptr2++;      // make sure we are not dealing with a case of url(cid:....)..if so, account for the url( and the closing ); at the       // end of the style rule      if ( (ptr2 - buf) > 8 && ( nsCRT::ToLower(buf[0]) == 'u' && nsCRT::ToLower(buf[1]) == 'r' &&                                    nsCRT::ToLower(buf[2]) == 'l' && buf[3] == '(' &&                                   nsCRT::ToLower(buf[4]) =='c'  && nsCRT::ToLower(buf[5]) =='i' &&                                    nsCRT::ToLower(buf[6]) =='d'  && buf[7]==':'))      {        // write out "url(:        status = real_write(relobj, buf, 4);        buf += 4;        // adjust the end ptr2 to go back to the close paren        if ( *(ptr2  - 1) == ';' && *(ptr2 - 2) == ')')          ptr2 -= 2;      }      /* Compare the beginning of the word with "cid:". Yuck. */      if (((ptr2 - buf) > 4) &&         ((nsCRT::ToLower(buf[0]) =='c') &&          (nsCRT::ToLower(buf[1]) =='i') &&          (nsCRT::ToLower(buf[2]) =='d') &&           buf[3]==':'))      {        // Make sure it's lowercase, otherwise it won't be found in the hash table        buf[0] = 'c'; buf[1] = 'i'; buf[2] = 'd';        /* Null terminate the word so we can... */        c = *ptr2;        *ptr2 = '\0';                /* Construct a URL out of the word. */        absolute = MakeAbsoluteURL(relobj->base_url, buf);        /* See if we have a mailbox part URL           corresponding to this cid. */        part_url = nsnull;        MimeHashValue * value = nsnull;        if (absolute)        {          value = (MimeHashValue *)PL_HashTableLookup(relobj->hash, buf);          part_url = value ? value->m_url : nsnull;          PR_FREEIF(absolute);        }                /*If we found a mailbox part URL, write that out instead.*/        if (part_url && accept_related_part(relobj, value->m_obj))        {          status = real_write(relobj, part_url, strlen(part_url));          if (status < 0) return status;          buf = ptr2; /* skip over the cid: URL we substituted */          /* don't show that object as attachment */          if (value->m_obj)            value->m_obj->dontShowAsAttachment = PR_TRUE;        }                /* Restore the character that we nulled. */        *ptr2 = c;      }      /* rhp - if we get here, we should still check against the hash table! */      else       {        char holder = *ptr2;        char *realout;        *ptr2 = '\0';            /* Construct a URL out of the word. */        absolute = MakeAbsoluteURL(relobj->base_url, buf);        /* See if we have a mailbox part URL           corresponding to this cid. */        MimeHashValue * value;        if (absolute)          value = (MimeHashValue *)PL_HashTableLookup(relobj->hash, absolute);        else          value = (MimeHashValue *)PL_HashTableLookup(relobj->hash, buf);        realout = value ? value->m_url : nsnull;        *ptr2 = holder;        PR_FREEIF(absolute);        if (realout && accept_related_part(relobj, value->m_obj))        {          status = real_write(relobj, realout, strlen(realout));          if (status < 0) return status;          buf = ptr2; /* skip over the cid: URL we substituted */          /* don't show that object as attachment */          if (value->m_obj)            value->m_obj->dontShowAsAttachment = PR_TRUE;        }      }      /* rhp - if we get here, we should still check against the hash table! */      /* Advance to the beginning of the next word, or to         the end of the value string. */      while((ptr2<ptr) && (nsCRT::IsAsciiSpace(*ptr2)))        ptr2++;      /* Write whatever original text remains after         cid: URL substitution. */      status = real_write(relobj, buf, ptr2-buf);      if (status < 0) return status;      buf = ptr2;    }  }  if (buf && *buf) {    status = real_write(relobj, buf, strlen(buf));    if (status < 0) return status;  }  relobj->curtag_length = 0;  return 0;}