*
*/
-#ifdef DLL_EXPORT
-#define IN_LIBCIT
-#endif
-
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
int s;
char setstr[128], lostr[64], histr[64];
long lo, hi;
+ int is_trash = 0;
/* If the supplied room name is NULL, the caller wants us to know that
* it has already copied the room record into CC->room, so
safestrncpy(truncated_roomname, &truncated_roomname[11], sizeof truncated_roomname);
}
+ if (!strcasecmp(truncated_roomname, USERTRASHROOM)) {
+ is_trash = 1;
+ }
+
if (retmsgs != NULL) *retmsgs = total_messages;
if (retnew != NULL) *retnew = new_messages;
lprintf(CTDL_DEBUG, "<%s> %d new of %d total messages\n",
CC->curr_view = (int)vbuf.v_view;
if (display_result) {
- cprintf("%d%c%s|%d|%d|%d|%d|%ld|%ld|%d|%d|%d|%d|%d|%d|\n",
+ cprintf("%d%c%s|%d|%d|%d|%d|%ld|%ld|%d|%d|%d|%d|%d|%d|%d|\n",
CIT_OK, CtdlCheckExpress(),
truncated_roomname,
(int)new_messages,
(int)newmailcount,
(int)CC->room.QRfloor,
(int)vbuf.v_view,
- (int)CC->room.QRdefaultview
+ (int)CC->room.QRdefaultview,
+ (int)is_trash
);
}
}
char tempfilename[PATH_MAX];
if (CtdlAccessCheck(ac_logged_in)) return;
- tmpnam(tempfilename);
+ CtdlMakeTempFileName(tempfilename, sizeof tempfilename);
getroom(&CC->room, CC->room.QRname);
getuser(&CC->user, CC->curr_user);
cprintf("%d not here.\n", ERROR + HIGHER_ACCESS_REQUIRED);
return;
}
- cprintf("%d %s|"
-#ifndef HAVE_DATA_DIR
- "."
-#else
- DATA_DIR
-#endif
- "/files/%s\n",
- LISTING_FOLLOWS, config.c_fqdn, CC->room.QRdirname);
+ cprintf("%d %s|%s/%s\n",
+ LISTING_FOLLOWS,
+ config.c_fqdn,
+ ctdl_file_dir,
+ CC->room.QRdirname);
- snprintf(buf, sizeof buf, "ls "
-#ifndef HAVE_DATA_DIR
- "."
-#else
- DATA_DIR
-#endif
- "/files/%s >%s 2> /dev/null",
- CC->room.QRdirname, tempfilename);
+ snprintf(buf, sizeof buf,
+ "ls %s/%s >%s 2>/dev/null",
+ ctdl_file_dir,
+ CC->room.QRdirname,
+ tempfilename);
system(buf);
snprintf(buf, sizeof buf,
-#ifndef HAVE_DATA_DIR
- "."
-#else
- DATA_DIR
-#endif
- "/files/%s/filedir", CC->room.QRdirname);
+ "%s/%s/filedir",
+ ctdl_file_dir,
+ CC->room.QRdirname);
fd = fopen(buf, "r");
if (fd == NULL)
fd = fopen("/dev/null", "r");
flnm[strlen(flnm) - 1] = 0;
if (strcasecmp(flnm, "filedir")) {
snprintf(buf, sizeof buf,
-#ifndef HAVE_DATA_DIR
- "."
-#else
- DATA_DIR
-#endif
- "/files/%s/%s",
- CC->room.QRdirname, flnm);
+ "%s/%s/%s",
+ ctdl_file_dir,
+ CC->room.QRdirname,
+ flnm);
stat(buf, &statbuf);
safestrncpy(comment, "", sizeof comment);
fseek(fd, 0L, 0);
/* Create a room directory if necessary */
if (CC->room.QRflags & QR_DIRECTORY) {
- snprintf(buf, sizeof buf,
-#ifndef HAVE_DATA_DIR
- "."
-#else
- DATA_DIR
-#endif
- "/files/%s", CC->room.QRdirname);
+ snprintf(buf, sizeof buf,"%s/%s",
+ ctdl_file_dir,
+ CC->room.QRdirname);
mkdir(buf, 0755);
}
- snprintf(buf, sizeof buf, "%s> edited by %s\n", CC->room.QRname, CC->curr_user);
+ snprintf(buf, sizeof buf, "The room \"%s\" has been edited by %s.\n",
+ CC->room.QRname, CC->curr_user);
aide_message(buf);
cprintf("%d Ok\n", CIT_OK);
}
if (post_notice == 1) {
if (strlen(usbuf.fullname) > 0)
snprintf(buf, sizeof buf,
- "%s is now room aide for %s>\n",
+ "%s is now the room aide for \"%s\".\n",
usbuf.fullname, CC->room.QRname);
else
snprintf(buf, sizeof buf,
- "There is now no room aide for %s>\n",
+ "There is now no room aide for \"%s\".\n",
CC->room.QRname);
aide_message(buf);
}
usergoto(config.c_baseroom, 0, 0, NULL, NULL);
/* tell the world what we did */
- snprintf(msg, sizeof msg, "%s> killed by %s\n",
+ snprintf(msg, sizeof msg, "The room \"%s\" has been deleted by %s.\n",
deleted_room_name, CC->curr_user);
aide_message(msg);
cprintf("%d '%s' deleted.\n", CIT_OK, deleted_room_name);
/* Grant the creator access to the room unless the avoid_access
* parameter was specified.
*/
- if (avoid_access == 0) {
- lgetuser(&CC->user, CC->curr_user);
+ if ( (CC->logged_in) && (avoid_access == 0) ) {
CtdlGetRelationship(&vbuf, &CC->user, &qrbuf);
vbuf.v_flags = vbuf.v_flags & ~V_FORGET & ~V_LOCKOUT;
vbuf.v_flags = vbuf.v_flags | V_ACCESS;
CtdlSetRelationship(&vbuf, &CC->user, &qrbuf);
- lputuser(&CC->user);
}
/* resume our happy day */
/* post a message in Aide> describing the new room */
notification_message = malloc(1024);
snprintf(notification_message, 1024,
- "%s> created by %s%s%s%s%s%s\n",
+ "A new room called \"%s\" has been created by %s%s%s%s%s%s\n",
new_room_name,
CC->user.fullname,
((newflags & QR_MAILBOX) ? " [personal]" : ""),