#define GF_ZAP 2 /* <;Z>ap floor mode */
-#define BASEROOM "Lobby"
-#define MAILROOM "Mail"
-#define AIDEROOM "Aide"
-#define CONFIGROOM "My Citadel Config"
-
#define SPOOLMIME "application/x-citadel-delivery-list"
/*
check_ref_counts();
lprintf(7, "Creating base rooms (if necessary)\n");
- create_room(BASEROOM, 0, "", 0);
- create_room(AIDEROOM, 4, "", 0);
- create_room(config.c_twitroom, 0, "", 0);
+ create_room(BASEROOM, 0, "", 0);
+ create_room(AIDEROOM, 4, "", 0);
+ create_room(SYSCONFIGROOM, 4, "", 0);
+ create_room(config.c_twitroom, 0, "", 0);
}
/*
char cmd[256];
char buf[256];
int a;
+ char *confptr;
+ char confname[256];
if (!(CC->logged_in)) {
cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
create_room(config.c_logpages, 4, "", 0);
}
+ else if (!strcasecmp(cmd, "GETSYS")) {
+ extract(confname, argbuf, 1);
+ confptr = CtdlGetSysConfig(confname);
+ if (confptr != NULL) {
+ cprintf("%d %s\n", LISTING_FOLLOWS, confname);
+ client_write(confptr, strlen(confptr));
+ if (confptr[strlen(confptr)-1] != 10)
+ client_write("\n", 1);
+ cprintf("000\n");
+ phree(confptr);
+ }
+ else {
+ cprintf("%d No such configuration.\n",
+ ERROR+ILLEGAL_VALUE);
+ }
+ }
+
+ else if (!strcasecmp(cmd, "PUTSYS")) {
+ extract(confname, argbuf, 1);
+ cprintf("%d %s\n", SEND_LISTING, confname);
+ confptr = CtdlReadMessageBody("000", config.c_maxmsglen, NULL);
+ CtdlPutSysConfig(confname, confptr);
+ phree(confptr);
+ }
+
else {
- cprintf("%d The only valid options are GET and SET.\n",
+ cprintf("%d Illegal option(s) specified.\n",
ERROR+ILLEGAL_VALUE);
}
}
#define msg_repl ((struct repl *)CtdlGetUserData(SYM_REPL))
extern struct config config;
+long config_msgnum;
char *msgkeys[] = {
"", "", "", "", "", "", "", "",
CtdlSaveMsg(msg, "", roomname, MES_LOCAL, 1);
CtdlFreeMessage(msg);
}
+
+
+
+
+
+
+void CtdlGetSysConfigBackend(long msgnum) {
+ config_msgnum = msgnum;
+}
+
+
+char *CtdlGetSysConfig(char *sysconfname) {
+ char hold_rm[ROOMNAMELEN];
+ long msgnum;
+ char *conf;
+ struct CtdlMessage *msg;
+ char buf[256];
+
+ strcpy(hold_rm, CC->quickroom.QRname);
+ if (getroom(&CC->quickroom, SYSCONFIGROOM) != 0) {
+ getroom(&CC->quickroom, hold_rm);
+ return NULL;
+ }
+
+
+ /* We want the last (and probably only) config in this room */
+ begin_critical_section(S_CONFIG);
+ config_msgnum = (-1L);
+ CtdlForEachMessage(MSGS_LAST, 1, sysconfname, NULL,
+ CtdlGetSysConfigBackend);
+ msgnum = config_msgnum;
+ end_critical_section(S_CONFIG);
+
+ if (msgnum < 0L) {
+ conf = NULL;
+ }
+ else {
+ msg = CtdlFetchMessage(msgnum);
+ if (msg != NULL) {
+ conf = strdoop(msg->cm_fields['M']);
+ CtdlFreeMessage(msg);
+ }
+ else {
+ conf = NULL;
+ }
+ }
+
+ getroom(&CC->quickroom, hold_rm);
+
+ if (conf != NULL) do {
+ extract_token(buf, conf, 0, '\n');
+ strcpy(conf, &conf[strlen(buf)+1]);
+ } while ( (strlen(conf)>0) && (strlen(buf)>0) );
+
+ return(conf);
+}
+
+void CtdlPutSysConfig(char *sysconfname, char *sysconfdata) {
+ char temp[PATH_MAX];
+ FILE *fp;
+
+ strcpy(temp, tmpnam(NULL));
+
+ fp = fopen(temp, "w");
+ if (fp == NULL) return;
+ fprintf(fp, "Content-type: %s\n\n", sysconfname);
+ fprintf(fp, "%s", sysconfdata);
+ fclose(fp);
+
+ /* this handy API function does all the work for us */
+ CtdlWriteObject(SYSCONFIGROOM, sysconfname, temp,
+ &CC->usersupp, 0, 1, 0);
+
+ unlink(temp);
+}
+
+
int ReplicationChecks(struct CtdlMessage *);
int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int flags);
char *CtdlReadMessageBody(char *terminator, size_t maxlen, char *exist);
+char *CtdlGetSysConfig(char *sysconfname);
+void CtdlPutSysConfig(char *sysconfname, char *sysconfdata);
char icq_rm[ROOMNAMELEN];
strcpy(hold_rm, CC->quickroom.QRname);
- MailboxName(icq_rm, &CC->usersupp, CONFIGROOM);
+ MailboxName(icq_rm, &CC->usersupp, USERCONFIGROOM);
strcpy(ThisICQ->icq_config, "");
if (getroom(&CC->quickroom, icq_rm) != 0) {
fclose(fp);
/* this handy API function does all the work for us */
- CtdlWriteObject(CONFIGROOM, ICQMIME, temp, &CC->usersupp, 0, 1, 0);
+ CtdlWriteObject(USERCONFIGROOM, ICQMIME, temp, &CC->usersupp, 0, 1, 0);
unlink(temp);
}
fclose(fp);
/* this handy API function does all the work for us */
- CtdlWriteObject(CONFIGROOM, ICQCLMIME, temp, &CC->usersupp, 0, 1, 0);
+ CtdlWriteObject(USERCONFIGROOM, ICQCLMIME, temp, &CC->usersupp, 0, 1, 0);
unlink(temp);
}
char icq_rm[ROOMNAMELEN];
strcpy(hold_rm, CC->quickroom.QRname);
- MailboxName(icq_rm, &CC->usersupp, CONFIGROOM);
+ MailboxName(icq_rm, &CC->usersupp, USERCONFIGROOM);
strcpy(ThisICQ->icq_config, "");
if (getroom(&CC->quickroom, icq_rm) != 0) {
fwrite(vcard, strlen(vcard)+1, 1, tp);
fclose(tp);
- CtdlWriteObject(CONFIGROOM, "text/x-vcard",
+ CtdlWriteObject(USERCONFIGROOM, "text/x-vcard",
tempfilename, &newus, 0, 1, CM_SKIP_HOOKS);
unlink(tempfilename);
}
/* If this isn't the configuration room, or if this isn't a MIME
* message, don't bother.
*/
- if (strcasecmp(msg->cm_fields['O'], CONFIGROOM)) return(0);
+ if (strcasecmp(msg->cm_fields['O'], USERCONFIGROOM)) return(0);
if (msg->cm_format_type != 4) return(0);
ptr = msg->cm_fields['M'];
* to make changes to another user's vCard instead of
* assuming that it's always the user saving his own.
*/
- MailboxName(config_rm, &CC->usersupp, CONFIGROOM);
+ MailboxName(config_rm, &CC->usersupp, USERCONFIGROOM);
CtdlDeleteMessages(config_rm, 0L, "text/x-vcard");
/* Set the Extended-ID to a standardized one so the
/* If this isn't the configuration room, or if this isn't a MIME
* message, don't bother.
*/
- if (strcasecmp(msg->cm_fields['O'], CONFIGROOM)) return(0);
+ if (strcasecmp(msg->cm_fields['O'], USERCONFIGROOM)) return(0);
if (msg->cm_format_type != 4) return(0);
ptr = msg->cm_fields['M'];
struct vCard *v;
strcpy(hold_rm, CC->quickroom.QRname); /* save current room */
- MailboxName(config_rm, u, CONFIGROOM);
+ MailboxName(config_rm, u, USERCONFIGROOM);
if (getroom(&CC->quickroom, config_rm) != 0) {
getroom(&CC->quickroom, hold_rm);
* have to, because the vcard_upload_beforesave() hook above
* is going to notice what we're trying to do, and delete the old vCard.
*/
- CtdlWriteObject(CONFIGROOM, /* which room */
+ CtdlWriteObject(USERCONFIGROOM, /* which room */
"text/x-vcard", /* MIME type */
temp, /* temp file */
u, /* which user */
S_NETDB,
S_SUPPMSGMAIN,
S_I_WANNA_SELECT,
+ S_CONFIG,
MAX_SEMAPHORES
};
*/
#define POP3_PORT 1110
#define SMTP_PORT 2525
+
+
+/*
+ * The names of rooms which are automatically created by the system
+ */
+#define BASEROOM "Lobby"
+#define MAILROOM "Mail"
+#define AIDEROOM "Aide"
+#define USERCONFIGROOM "My Citadel Config"
+#define SYSCONFIGROOM "Local System Configuration"
#define SMTP_SPOOLOUT_ROOM "__CitadelSMTPspoolout__"