rv = nsGetMailboxServer(username, hostname, getter_AddRefs(server)); delete[] username; delete[] hostname;
rv = nsGetMailboxServer(uriStr, getter_AddRefs(server));
nsLocalURI2Server(const char* uriStr,                  nsIMsgIncomingServer ** aResult){  nsresult rv;  // start parsing the uriStr  const char* curPos = uriStr;    // skip past schema xxx://  while (*curPos != ':') curPos++;  curPos++;  while (*curPos == '/') curPos++;  // extract userid from userid@hostname...  // this is so amazingly ugly, please forgive me....  // I'll fix this post-M7 -alecf@netscape.com  char *atPos = PL_strchr(curPos, '@');  NS_ASSERTION(atPos!=nsnull, "URI with no userid!");    int length;  if (atPos)    length = (atPos - curPos) + 1;  else {    length = 1;  }  char *username = new char[length];  if (!username) return NS_ERROR_OUT_OF_MEMORY;  if (atPos) {    PL_strncpyz(username, curPos, length);    curPos = atPos;    curPos++;  }      else    username[0] = '\0';  // extract hostname  char *slashPos = PL_strchr(curPos, '/');  // if there are no more /'s then we just copy the rest of the string  if (slashPos)    length = (slashPos - curPos) + 1;  else    length = PL_strlen(curPos) + 1;  char* hostname = new char[length];  if(!hostname)	  return NS_ERROR_OUT_OF_MEMORY;  PL_strncpyz(hostname, curPos, length);  nsCOMPtr<nsIMsgIncomingServer> server;  rv = nsGetMailboxServer(username, hostname, getter_AddRefs(server));  delete[] username;  delete[] hostname;  *aResult = server;  NS_IF_ADDREF(*aResult);  return rv;}