if (port == IMAP_PORT) snprintf (dest, len, "{%s}%s%s", host, NONULL (path), NONULL (name)); else snprintf (dest, len, "{%s:%d}%s%s", host, port, NONULL (path), NONULL (name));
char tmp[128];  strcpy (dest, "{"); if ((mx->flags & M_IMAP_USER) && (!ImapUser || strcmp (mx->user, ImapUser))) { snprintf (tmp, sizeof (tmp), "%s@", mx->user); strncat (dest, tmp, len); } strncat (dest, mx->host, len); if (mx->flags & M_IMAP_PORT) { snprintf (tmp, sizeof (tmp), ":%d", mx->port); strncat (dest, tmp, len); } #ifdef USE_SSL if (mx->flags & M_IMAP_TYPE) { snprintf (tmp, sizeof (tmp), "/%s", mx->type); strncat (dest, tmp, len); } #endif snprintf (tmp, sizeof (tmp), "}%s%s", NONULL (path), NONULL (name)); strncat (dest, tmp, len);
void imap_qualify_path (char* dest, size_t len, const char* host, int port,  const char* path, const char* name){  if (port == IMAP_PORT)    snprintf (dest, len, "{%s}%s%s", host, NONULL (path), NONULL (name));  else    snprintf (dest, len, "{%s:%d}%s%s", host, port, NONULL (path),      NONULL (name));}