We do this in a couple of different places so it's going into libcitadel.
#define REV_LEVEL 732 /* This version */
#define REV_MIN 591 /* Oldest compatible database */
#define EXPORT_REV_MIN 725 /* Oldest compatible export files */
-#define LIBCITADEL_MIN 108 /* Minimum required version of libcitadel */
+#define LIBCITADEL_MIN 109 /* Minimum required version of libcitadel */
#define SERVER_TYPE 0 /* zero for stock Citadel; other developers please
obtain SERVER_TYPE codes for your implementations */
snprintf(buf, sizeof buf, "%s", author->fullname);
msg->cm_fields['P'] = strdup(buf);
}
- for (i=0; (msg->cm_fields['P'][i]!=0); ++i) {
- if (isspace(msg->cm_fields['P'][i])) {
- msg->cm_fields['P'][i] = '_';
- }
- }
+ convert_spaces_to_underscores(msg->cm_fields['P']);
snprintf(buf, sizeof buf, "%ld", (long)time(NULL)); /* timestamp */
msg->cm_fields['T'] = strdup(buf);
*/
snprintf(CC->cs_inet_email, sizeof CC->cs_inet_email, "%s@%s",
CC->user.fullname, config.c_fqdn);
- for (i=0; !IsEmptyStr(&CC->cs_inet_email[i]); ++i) {
- if (isspace(CC->cs_inet_email[i])) {
- CC->cs_inet_email[i] = '_';
- }
- }
+ convert_spaces_to_underscores(CC->cs_inet_email);
/* Create any personal rooms required by the system.
* (Technically, MAILROOM should be there already, but just in case...)
*/
#include <time.h>
#include <stdlib.h>
-#define LIBCITADEL_VERSION_NUMBER 108
+#define LIBCITADEL_VERSION_NUMBER 109
/*
* Here's a bunch of stupid magic to make the MIME parser portable.
const void *GetSearchPayload(const void *HashVoid);
void SortByPayload(HashList *Hash, CompareFunc SortBy);
+void convert_spaces_to_underscores(char *str);
}
-/**
- * \brief Strip leading and trailing spaces from a string; with premeasured and adjusted length.
- * \param buf the string to modify
- * \param len length of the string.
+/*
+ * Strip leading and trailing spaces from a string; with premeasured and adjusted length.
+ * buf - the string to modify
+ * len - length of the string.
*/
void stripltlen(char *buf, int *len)
{
}
}
+
+/*
+ * Convert all whitespace characters in a supplied string to underscores
+ */
+void convert_spaces_to_underscores(char *str)
+{
+ int len;
+ int i;
+
+ if (!str) return;
+
+ len = strlen(str);
+ for (i=0; i<len; ++i) {
+ if (isspace(str[i])) {
+ str[i] = '_';
+ }
+ }
+}
#define CLIENT_ID 4
#define CLIENT_VERSION 734 /* This version of WebCit */
#define MINIMUM_CIT_VERSION 730 /* min required Citadel ver */
-#define LIBCITADEL_MIN 108 /* min required libcitadel ver */
+#define LIBCITADEL_MIN 109 /* min required libcitadel ver */
#define DEFAULT_HOST "localhost" /* Default Citadel server */
#define DEFAULT_PORT "504"
#define LB (1) /* Internal escape chars */