- /*
- * At this point, we assume the bug has two fields -- a user@host
- * part, and an ID part. Either field may contain spurious @ signs.
- * The previous version of this code presumed one could split at
- * the rightmost '@'. This is not correct, as InterMail puts an
- * '@' in the UIDL.
- */
-
- /* very first, skip leading spaces */
- user = buf + strspn(buf, " \t");
-
- /* First, we split the buf into a userhost part and an id part */
- if ( (delimp1 = strpbrk(user, " \t")) != NULL ) {
- id = delimp1 + strspn(delimp1, " \t"); /* set pointer to id */
- saveddelim1 = *delimp1; /* save char after token */
+ /*
+ * At this point, we assume the bug has two fields -- a user@host
+ * part, and an ID part. Either field may contain spurious @ signs.
+ * The previous version of this code presumed one could split at
+ * the rightmost '@'. This is not correct, as InterMail puts an
+ * '@' in the UIDL.
+ */
+
+ /* first, skip leading spaces */
+ user = buf + strspn(buf, " \t");
+
+ /*
+ * First, we split the buf into a userhost part and an id
+ * part ... but id doesn't necessarily start with a '<',
+ * espescially if the POP server returns an X-UIDL header
+ * instead of a Message-ID, as GMX's (www.gmx.net) POP3
+ * StreamProxy V1.0 does.
+ *
+ * this is one other trick. The userhost part
+ * may contain ' ' in the user part, at least in
+ * the lotus notes case.
+ * So we start looking for the '@' after which the
+ * host will follow with the ' ' separator with the id.
+ *
+ * XXX FIXME: There is a case this code cannot handle:
+ * the user name cannot have blanks after a '@'.
+ */
+ if ((delimp1 = strchr(user, '@')) != NULL &&
+ (id = strchr(delimp1,' ')) != NULL)
+ {
+ for (delimp1 = id; delimp1 >= user; delimp1--)
+ if ((*delimp1 != ' ') && (*delimp1 != '\t'))
+ break;
+
+ /*
+ * It should be safe to assume that id starts after
+ * the " " - after all, we're writing the " "
+ * ourselves in write_saved_lists() :-)
+ */
+ id = id + strspn(id, " ");
+
+ delimp1++; /* but what if there is only white space ?!? */
+ /* we have at least one @, else we are not in this branch */
+ saveddelim1 = *delimp1; /* save char after token */