X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fuser_ops.c;h=f5d6bd0069ea3099b7d9840b3da3568c172f5fdb;hb=e61cfdd4e3b31f3a4c73390d58007e67995e6667;hp=9c1ade6fb32d382863c15f4a208ad8483450f895;hpb=bdad99ff14a8f20d95227078079639004dcc9e7d;p=citadel.git diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 9c1ade6fb..f5d6bd006 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -229,6 +229,12 @@ void CtdlGetRelationship(struct visit *vbuf, sizeof(struct visit) : cdbvisit->len)); cdb_free(cdbvisit); } + else { + /* If this is the first time the user has seen this room, + * set the view to be the default for the room. + */ + vbuf->v_view = rel_room->QRdefaultview; + } /* Set v_seen if necessary */ if (vbuf->v_seen[0] == 0) { @@ -1420,3 +1426,24 @@ int NewMailCount() return (num_newmsgs); } + + +/* + * Set the preferred view for the current user/room combination + */ +void cmd_view(char *cmdbuf) { + int requested_view; + struct visit vbuf; + + if (CtdlAccessCheck(ac_logged_in)) { + return; + } + + requested_view = extract_int(cmdbuf, 0); + + CtdlGetRelationship(&vbuf, &CC->usersupp, &CC->quickroom); + vbuf.v_view = requested_view; + CtdlSetRelationship(&vbuf, &CC->usersupp, &CC->quickroom); + + cprintf("%d ok\n", CIT_OK); +}