int CtdlLockGetCurrentUser(void);
void CtdlPutCurrentUserLock(void);
int CtdlGetUserByNumber(struct ctdluser *usbuf, long number);
-void CtdlGetRelationship(visit *vbuf, struct ctdluser *rel_user, struct ctdlroom *rel_room);
-void CtdlSetRelationship(visit *newvisit, struct ctdluser *rel_user, struct ctdlroom *rel_room);
+void CtdlGetRelationship(struct visit *vbuf, struct ctdluser *rel_user, struct ctdlroom *rel_room);
+void CtdlSetRelationship(struct visit *newvisit, struct ctdluser *rel_user, struct ctdlroom *rel_room);
void CtdlMailboxName(char *buf, size_t n, const struct ctdluser *who, const char *prefix);
int CtdlLoginExistingUser(const char *username);
void ical_CtdlCreateRoom(void)
{
struct ctdlroom qr;
- visit vbuf;
+ struct visit vbuf;
/* Create the calendar room if it doesn't already exist */
CtdlCreateRoom(USERCALENDARROOM, 4, "", 0, 1, 0, VIEW_CALENDAR);
// set last read pointer (marks all messages in the current room as read, up to the specified point)
void cmd_slrp(char *new_ptr) {
long newlr;
- visit vbuf;
- visit original_vbuf;
+ struct visit vbuf;
+ struct visit original_vbuf;
if (CtdlAccessCheck(ac_logged_in)) {
return;
CtdlLockGetCurrentUser();
CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
- memcpy(&original_vbuf, &vbuf, sizeof(visit));
+ memcpy(&original_vbuf, &vbuf, sizeof(struct visit));
vbuf.v_lastseen = newlr;
snprintf(vbuf.v_seen, sizeof vbuf.v_seen, "*:%ld", newlr);
void cmd_gtsn(char *argbuf) {
- visit vbuf;
+ struct visit vbuf;
if (CtdlAccessCheck(ac_logged_in)) {
return;
// Set the preferred view for the current user/room combination
void cmd_view(char *cmdbuf) {
int requested_view;
- visit vbuf;
+ struct visit vbuf;
if (CtdlAccessCheck(ac_logged_in)) {
return;
//
int PurgeVisits(void) {
struct cdbdata *cdbvisit;
- visit vbuf;
+ struct visit vbuf;
struct VPurgeList *VisitPurgeList = NULL;
struct VPurgeList *vptr;
int purged = 0;
// Now traverse through the visits, purging irrelevant records...
cdb_rewind(CDB_VISIT);
while(cdbvisit = cdb_next_item(CDB_VISIT), cdbvisit != NULL) {
- memset(&vbuf, 0, sizeof(visit));
+ memset(&vbuf, 0, sizeof(struct visit));
memcpy(&vbuf, cdbvisit->ptr,
- ( (cdbvisit->len > sizeof(visit)) ?
- sizeof(visit) : cdbvisit->len) );
+ ( (cdbvisit->len > sizeof(struct visit)) ?
+ sizeof(struct visit) : cdbvisit->len) );
cdb_free(cdbvisit);
RoomIsValid = 0;
int setting_user_value = 0;
char set_value[32];
int set_view = VIEW_BBS;
- visit vbuf;
+ struct visit vbuf;
if (num_parms != 6) {
IReply("BAD usage error");
*/
void imap_set_seen_flags(int first_msg) {
citimap *Imap = IMAP;
- visit vbuf;
+ struct visit vbuf;
int i;
int num_sets;
int s;
// Traverse the visits file...
void migr_export_visits(void) {
- visit vbuf;
+ struct visit vbuf;
struct cdbdata *cdbv;
cdb_rewind(CDB_VISIT);
while (cdbv = cdb_next_item(CDB_VISIT), cdbv != NULL) {
- memset(&vbuf, 0, sizeof(visit));
+ memset(&vbuf, 0, sizeof(struct visit));
memcpy(&vbuf, cdbv->ptr,
- ((cdbv->len > sizeof(visit)) ?
- sizeof(visit) : cdbv->len));
+ ((cdbv->len > sizeof(struct visit)) ?
+ sizeof(struct visit) : cdbv->len));
cdb_free(cdbv);
client_write(HKEY("<visit>\n"));
char FRname[ROOMNAMELEN];
struct floor flbuf;
int floornum = 0;
-visit vbuf;
+struct visit vbuf;
struct MetaData smi;
long import_msgnum = 0;
// When we begin receiving XML for one of these record types, clear out the associated
// buffer so we don't accidentally carry over any data from a previous record.
- if (!strcasecmp(el, "user")) memset(&usbuf, 0, sizeof (struct ctdluser));
+ if (!strcasecmp(el, "user")) memset(&usbuf, 0, sizeof(struct ctdluser));
else if (!strcasecmp(el, "openid")) memset(openid_url, 0, sizeof openid_url);
- else if (!strcasecmp(el, "room")) memset(&qrbuf, 0, sizeof (struct ctdlroom));
+ else if (!strcasecmp(el, "room")) memset(&qrbuf, 0, sizeof(struct ctdlroom));
else if (!strcasecmp(el, "room_messages")) memset(FRname, 0, sizeof FRname);
- else if (!strcasecmp(el, "floor")) memset(&flbuf, 0, sizeof (struct floor));
- else if (!strcasecmp(el, "visit")) memset(&vbuf, 0, sizeof (visit));
+ else if (!strcasecmp(el, "floor")) memset(&flbuf, 0, sizeof(struct floor));
+ else if (!strcasecmp(el, "visit")) memset(&vbuf, 0, sizeof(struct visit));
else if (!strcasecmp(el, "message")) {
memset(&smi, 0, sizeof (struct MetaData));
// (This should be called only once, by pop3_pass(), and returns the number
// of messages in the inbox, or -1 for error)
int pop3_grab_mailbox(void) {
- visit vbuf;
+ struct visit vbuf;
int i;
if (CtdlGetRoom(&CC->room, MAILROOM) != 0) return(-1);
// Perform "UPDATE state" stuff
void pop3_update(void) {
int i;
- visit vbuf;
+ struct visit vbuf;
long *deletemsgs = NULL;
int num_deletemsgs = 0;
void vcard_CtdlCreateRoom(void)
{
struct ctdlroom qr;
- visit vbuf;
+ struct visit vbuf;
/* Create the calendar room if it doesn't already exist */
CtdlCreateRoom(USERCONTACTSROOM, 4, "", 0, 1, 0, VIEW_ADDRESSBOOK);
// Retrieve the "seen" message list for the current room.
void CtdlGetSeen(char *buf, int which_set) {
- visit vbuf;
+ struct visit vbuf;
// Learn about the user and room in question
CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
int was_seen = 0;
long lo = (-1L);
long hi = (-1L);
- visit vbuf;
+ struct visit vbuf;
long *msglist;
int num_msgs = 0;
StrBuf *vset;
void *userdata)
{
int a, i, j;
- visit vbuf;
+ struct visit vbuf;
struct cdbdata *cdbfr;
long *msglist = NULL;
int num_msgs = 0;
// Yes, it has a couple of gotos. If you don't like that, go die in a car fire.
void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf, int *result, int *view) {
int retval = 0;
- visit vbuf;
+ struct visit vbuf;
int is_me = 0;
int is_guest = 0;
int info = 0;
int rmailflag;
int raideflag;
- visit vbuf;
+ struct visit vbuf;
char truncated_roomname[ROOMNAMELEN];
struct cdbdata *cdbfr;
long *msglist = NULL;
{
struct ctdlroom qrbuf;
struct floor flbuf;
- visit vbuf;
+ struct visit vbuf;
syslog(LOG_DEBUG, "room_ops: CtdlCreateRoom(name=%s, type=%d, view=%d)", new_room_name, new_room_type, new_room_view);
// Defines the relationship of a user to a particular room
-typedef struct __visit {
+struct visit {
long v_roomnum;
long v_roomgen;
long v_usernum;
char v_seen[SIZ];
char v_answered[SIZ];
int v_view;
-} visit;
+};
// Supplementary data for a message on disk
// Back end for CtdlSetRelationship()
-void put_visit(visit *newvisit) {
+void put_visit(struct visit *newvisit) {
char IndexBuf[32];
int IndexLen = 0;
// Store the record
cdb_store(CDB_VISIT, IndexBuf, IndexLen,
- newvisit, sizeof(visit)
+ newvisit, sizeof(struct visit)
);
}
// Define a relationship between a user and a room
-void CtdlSetRelationship(visit *newvisit, struct ctdluser *rel_user, struct ctdlroom *rel_room) {
+void CtdlSetRelationship(struct visit *newvisit, struct ctdluser *rel_user, struct ctdlroom *rel_room) {
// We don't use these in Citadel because they're implicit by the
// index, but they must be present if the database is exported.
newvisit->v_roomnum = rel_room->QRnumber;
// Locate a relationship between a user and a room
-void CtdlGetRelationship(visit *vbuf, struct ctdluser *rel_user, struct ctdlroom *rel_room) {
+void CtdlGetRelationship(struct visit *vbuf, struct ctdluser *rel_user, struct ctdlroom *rel_room) {
char IndexBuf[32];
int IndexLen;
struct cdbdata *cdbvisit;
IndexLen = GenerateRelationshipIndex(IndexBuf, rel_room->QRnumber, rel_room->QRgen, rel_user->usernum);
// Clear out the buffer
- memset(vbuf, 0, sizeof(visit));
+ memset(vbuf, 0, sizeof(struct visit));
cdbvisit = cdb_fetch(CDB_VISIT, IndexBuf, IndexLen);
if (cdbvisit != NULL) {
- memcpy(vbuf, cdbvisit->ptr, ((cdbvisit->len > sizeof(visit)) ? sizeof(visit) : cdbvisit->len));
+ memcpy(vbuf, cdbvisit->ptr, ((cdbvisit->len > sizeof(struct visit)) ? sizeof(struct visit) : cdbvisit->len));
cdb_free(cdbvisit);
}
else {
// Set iuser to the name of the user, and op to 1=invite or 0=kick
int CtdlInvtKick(char *iuser, int op) {
struct ctdluser USscratch;
- visit vbuf;
+ struct visit vbuf;
char bbb[SIZ];
if (CtdlGetUser(&USscratch, iuser) != 0) {
// Forget (Zap) the current room (API call)
// Returns 0 on success
int CtdlForgetThisRoom(void) {
- visit vbuf;
+ struct visit vbuf;
// On some systems, Admins are not allowed to forget rooms
if (is_aide() && (CtdlGetConfigInt("c_aide_zap") == 0)
int a;
char mailboxname[ROOMNAMELEN];
struct ctdlroom mailbox;
- visit vbuf;
+ struct visit vbuf;
struct cdbdata *cdbfr;
long *msglist = NULL;
int num_msgs = 0;
void ForEachUser(void (*CallBack) (char *, void *out_data), void *in_data);
int NewMailCount(void);
int InitialMailCheck(void);
-void put_visit(visit *newvisit);
+void put_visit(struct visit *newvisit);
int GenerateRelationshipIndex(char *IndexBuf, long RoomID, long RoomGen, long UserID);
int CtdlAssociateSystemUser(char *screenname, char *loginname);