}
+void cmd_biff(char *argbuf) { // has new mail arrived?
+ cprintf("%d %d\n", CIT_OK, NewMailCount());
+}
+
+
// Initialization function, called from modules_init.c
char *ctdl_module_init_serv_user(void) {
if (!threading) {
CtdlRegisterProtoHook(cmd_renu, "RENU", "Rename a user");
CtdlRegisterProtoHook(cmd_newu, "NEWU", "Log in as a new user");
CtdlRegisterProtoHook(cmd_isme, "ISME", "Determine whether an email address belongs to a user");
+ CtdlRegisterProtoHook(cmd_biff, "BIFF", "Count new messages that have arrived in the inbox");
}
/* return our Subversion id for the Log */
return "user";
// Check to see whether we have permission to post a message in the current
// room. Returns a *CITADEL ERROR CODE* and puts a message in errmsgbuf, or
// returns 0 on success.
-int CtdlDoIHavePermissionToPostInThisRoom(
- char *errmsgbuf,
- size_t n,
- PostType PostPublic,
- int is_reply
-) {
+int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf, size_t n, PostType PostPublic, int is_reply) {
int ra;
if (!(CC->logged_in) && (PostPublic == POST_LOGGED_IN)) {
// Make the specified room the current room for this session. No validation
// or access control is done here -- the caller should make sure that the
// specified room exists and is ok to access.
-void CtdlUserGoto(char *where, int display_result, int transiently,
- int *retmsgs, int *retnew, long *retoldest, long *retnewest)
-{
+void CtdlUserGoto(char *where, int display_result, int transiently, int *retmsgs, int *retnew, long *retoldest, long *retnewest) {
int a;
int new_messages = 0;
int old_messages = 0;
int info = 0;
int rmailflag;
int raideflag;
- int newmailcount = 0;
visit vbuf;
char truncated_roomname[ROOMNAMELEN];
struct cdbdata *cdbfr;
}
end_critical_section(S_USERS);
- // Check for new mail
- newmailcount = NewMailCount();
-
// Set info to 1 if the room banner is new since our last visit.
// Some clients only want to display it when it changes.
if (CC->room.msgnum_info > vbuf.v_lastseen) {
(long)vbuf.v_lastseen,
(int)rmailflag,
(int)raideflag,
- (int)newmailcount,
+ 0, // new mail is no longer counted here
(int)CC->room.QRfloor,
(int)vbuf.v_view,
(int)CC->room.QRdefaultview,
}
-// Count the number of new mail messages the user has
+// Return the number of new messages that have arrived in the user's inbox while they were logged in.
+// Resets to zero when called.
int NewMailCount() {
int num_newmsgs = 0;
num_newmsgs = CC->newmail;
void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) {
char aaa[SIZ], bbb[SIZ];
static long ls = 0L;
- int newmailcount = 0;
int partial_match, best_match;
char from_floor;
int ugpos = uglistsize;
if (room->RRinfoupdated > 0)
readinfo(ipc);
- /* check for newly arrived mail if we can */
- newmailcount = room->RRnewmail;
+ /* check for newly arrived mail if we can FIXME use BIFF command for this
if (newmailcount > 0) {
color(BRIGHT_RED);
if (newmailcount == 1) {
scr_printf("*** failed to check for mail calling %s Reason %d.\n", rc_gotmail_cmd, rv);
}
}
+ */
+
free(room);
if (screenwidth > 5)
snprintf(&status_line[1], screenwidth - 1, "%s | %s | %s | %s | %d new mail |",
(secure ? "Encrypted" : "Unencrypted"),
- ipc->ServInfo.humannode, ipc->ServInfo.site_location, room_name, newmailcount);
+ ipc->ServInfo.humannode, ipc->ServInfo.site_location, room_name, 0); // FIXME use BIFF
}
rret[0]->RRlastread = extract_long(cret, 6);
rret[0]->RRismailbox = extract_int(cret, 7);
rret[0]->RRaide = extract_int(cret, 8);
- rret[0]->RRnewmail = extract_long(cret, 9);
+ // position 9 is no longer used
rret[0]->RRfloor = extract_int(cret, 10);
rret[0]->RRcurrentview = extract_int(cret, 11);
rret[0]->RRdefaultview = extract_int(cret, 12);
- /* position 13 is a trash folder flag ... irrelevant in this client */
+ // position 13 is a trash folder flag ... irrelevant in this client
rret[0]->RRflags2 = extract_int(cret, 14);
}
else {
long RRlastread; /* Highest message user has read */
char RRismailbox; /* Is this room a mailbox room? */
char RRaide; /* User can do aide commands in room */
- long RRnewmail; /* Number of new mail messages */
char RRfloor; /* Which floor this room is on */
char RRcurrentview; /* The user's current view for this room */
char RRdefaultview; /* The default view for this room */
room->RAFlags |= UA_ADMINALLOWED;
}
- room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|');
+ StrBufExtractNext_long(Line, &Pos, '|'); // position 9 is unused
room->floorid = StrBufExtractNext_int(Line, &Pos, '|');
room->view = StrBufExtractNext_long(Line, &Pos, '|');
room->defview = StrBufExtractNext_long(Line, &Pos, '|');
long LastMessageRead;
long HighestRead;
int ShowInfo;
- int UsersNewMAilboxMessages; /* should we notify the user about new messages? */
int IsTrash;
/* Only available if certain other commands ran */
int XHaveRoomPic;