* do typedef the visit struct, remove all those 'struct' statements from all over...
authorWilfried Göesgens <willi@citadel.org>
Sat, 28 Aug 2010 13:10:50 +0000 (13:10 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 28 Aug 2010 13:10:50 +0000 (13:10 +0000)
13 files changed:
citadel/include/ctdl_module.h
citadel/modules/calendar/serv_calendar.c
citadel/modules/expire/serv_expire.c
citadel/modules/imap/imap_metadata.c
citadel/modules/imap/serv_imap.c
citadel/modules/migrate/serv_migrate.c
citadel/modules/pop3/serv_pop3.c
citadel/modules/vcard/serv_vcard.c
citadel/msgbase.c
citadel/room_ops.c
citadel/server.h
citadel/user_ops.c
citadel/user_ops.h

index 21550ed872be44eaa9f0487e28b72a4ffbb17cbc..de09394619820ec4e8dab747b1873d2cf4a5bb7e 100644 (file)
@@ -309,10 +309,10 @@ int CtdlGetUserLock(struct ctdluser *usbuf, char *name);
 void CtdlPutUser(struct ctdluser *usbuf);
 void CtdlPutUserLock(struct ctdluser *usbuf);
 int CtdlGetUserByNumber(struct ctdluser *usbuf, long number);
-void CtdlGetRelationship(struct visit *vbuf,
+void CtdlGetRelationship(visit *vbuf,
                         struct ctdluser *rel_user,
                         struct ctdlroom *rel_room);
-void CtdlSetRelationship(struct visit *newvisit,
+void CtdlSetRelationship(visit *newvisit,
                         struct ctdluser *rel_user,
                         struct ctdlroom *rel_room);
 void CtdlMailboxName(char *buf, size_t n, const struct ctdluser *who, const char *prefix);
index 2e69934478d5f0994b78592ecea2edf4d8784446..e1e02ae544b0caf6c73704ec66cb2675e51d1422 100644 (file)
@@ -1907,7 +1907,7 @@ void cmd_ical(char *argbuf)
 void ical_CtdlCreateRoom(void)
 {
        struct ctdlroom qr;
-       struct visit vbuf;
+       visit vbuf;
 
        /* Create the calendar room if it doesn't already exist */
        CtdlCreateRoom(USERCALENDARROOM, 4, "", 0, 1, 0, VIEW_CALENDAR);
index eaae100b38579389b35c6af2b7bd2af2e23f4a2d..25c926bf1b31d86acabe359ab338c947ed10fa14 100644 (file)
@@ -614,7 +614,7 @@ int PurgeUsers(void) {
  */
 int PurgeVisits(void) {
        struct cdbdata *cdbvisit;
-       struct visit vbuf;
+       visit vbuf;
        struct VPurgeList *VisitPurgeList = NULL;
        struct VPurgeList *vptr;
        int purged = 0;
@@ -633,10 +633,10 @@ int PurgeVisits(void) {
        /* 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(struct visit));
+               memset(&vbuf, 0, sizeof(visit));
                memcpy(&vbuf, cdbvisit->ptr,
-                       ( (cdbvisit->len > sizeof(struct visit)) ?
-                       sizeof(struct visit) : cdbvisit->len) );
+                       ( (cdbvisit->len > sizeof(visit)) ?
+                         sizeof(visit) : cdbvisit->len) );
                cdb_free(cdbvisit);
 
                RoomIsValid = 0;
index 09f8022af88fae6e919b76d79d172ab7deba9afe..7dc3179ad954f0641ef4eaaeecb8f4faa4a4ce04 100644 (file)
@@ -83,7 +83,7 @@ void imap_setmetadata(int num_parms, ConstStr *Params) {
        int setting_user_value = 0;
        char set_value[32];
        int set_view = VIEW_BBS;
-       struct visit vbuf;
+       visit vbuf;
 
        if (num_parms != 6) {
                cprintf("%s BAD usage error\r\n", Params[0].Key);
index 27c0da4ccbb424f7082b728972d2310d344d7400..eca6f3c7fdc80df87df4b6602d50be9b9426bbec 100644 (file)
@@ -128,7 +128,7 @@ void imap_free_transmitted_message(void)
  */
 void imap_set_seen_flags(int first_msg)
 {
-       struct visit vbuf;
+       visit vbuf;
        int i;
        int num_sets;
        int s;
index cf8512916f0a6e8699380e33d3fb52ed4ff61487..8b431c8afbfdf021b9f290da5c5746ad85688e08 100644 (file)
@@ -213,16 +213,16 @@ void migr_export_floors(void) {
  *  Traverse the visits file...
  */
 void migr_export_visits(void) {
-       struct visit vbuf;
+       visit vbuf;
        struct cdbdata *cdbv;
 
        cdb_rewind(CDB_VISIT);
 
        while (cdbv = cdb_next_item(CDB_VISIT), cdbv != NULL) {
-               memset(&vbuf, 0, sizeof(struct visit));
+               memset(&vbuf, 0, sizeof(visit));
                memcpy(&vbuf, cdbv->ptr,
-                      ((cdbv->len > sizeof(struct visit)) ?
-                       sizeof(struct visit) : cdbv->len));
+                      ((cdbv->len > sizeof(visit)) ?
+                       sizeof(visit) : cdbv->len));
                cdb_free(cdbv);
 
                client_write("<visit>\n", 8);
@@ -497,7 +497,7 @@ long openid_usernum = 0;
 char FRname[ROOMNAMELEN];
 struct floor flbuf;
 int floornum = 0;
-struct visit vbuf;
+visit vbuf;
 struct MetaData smi;
 long import_msgnum = 0;
 char *decoded_msg = NULL;
@@ -561,7 +561,7 @@ void migr_xml_start(void *data, const char *el, const char **attr) {
        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 (struct visit));
+       else if (!strcasecmp(el, "visit"))              memset(&vbuf, 0, sizeof (visit));
 
        else if (!strcasecmp(el, "message")) {
                memset(&smi, 0, sizeof (struct MetaData));
index 2c1402dbde6ff72cbc1aca20fdbbb4448204570b..50c2749016b7c28af44e7a9bfbff82f72a2cb07a 100644 (file)
@@ -185,7 +185,7 @@ void pop3_add_message(long msgnum, void *userdata) {
  * of messages in the inbox, or -1 for error)
  */
 int pop3_grab_mailbox(void) {
-        struct visit vbuf;
+        visit vbuf;
        int i;
 
        if (CtdlGetRoom(&CC->room, MAILROOM) != 0) return(-1);
@@ -472,7 +472,7 @@ void pop3_dele(char *argbuf) {
  */
 void pop3_update(void) {
        int i;
-        struct visit vbuf;
+        visit vbuf;
 
        long *deletemsgs = NULL;
        int num_deletemsgs = 0;
index fcfd5f3d892bcee8026988085ec7ff73671a15e8..71525578bdc04d90aea235ca78ffad74eb30bbec 100644 (file)
@@ -1171,7 +1171,7 @@ void check_get_greeting(void) {
 void vcard_CtdlCreateRoom(void)
 {
        struct ctdlroom qr;
-       struct visit vbuf;
+       visit vbuf;
 
        /* Create the calendar room if it doesn't already exist */
        CtdlCreateRoom(USERCONTACTSROOM, 4, "", 0, 1, 0, VIEW_ADDRESSBOOK);
index 6ea0f55a2a864ee4347110ad999c1096dc9bd2a4..5178f2c5157c38e33750f95f50693dbbd27eec0f 100644 (file)
@@ -356,7 +356,7 @@ int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template) {
  * Retrieve the "seen" message list for the current room.
  */
 void CtdlGetSeen(char *buf, int which_set) {
-       struct visit vbuf;
+       visit vbuf;
 
        /* Learn about the user and room in question */
        CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
@@ -381,7 +381,7 @@ void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
        int was_seen = 0;
        long lo = (-1L);
        long hi = (-1L);
-       struct visit vbuf;
+       visit vbuf;
        long *msglist;
        int num_msgs = 0;
        StrBuf *vset;
@@ -607,7 +607,7 @@ int CtdlForEachMessage(int mode, long ref, char *search_string,
 {
 
        int a, i, j;
-       struct visit vbuf;
+       visit vbuf;
        struct cdbdata *cdbfr;
        long *msglist = NULL;
        int num_msgs = 0;
index 0cba9768b3a4e580b129e67dcc87bac219530061..25d335220fd1eb5d4de9b82155873e84dbd58cd3 100644 (file)
@@ -53,7 +53,7 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
                int *result, int *view)
 {
        int retval = 0;
-       struct visit vbuf;
+       visit vbuf;
 
        /* for internal programs, always do everything */
        if (((CC->internal_pgm)) && (roombuf->QRflags & QR_INUSE)) {
@@ -887,7 +887,7 @@ void CtdlUserGoto(char *where, int display_result, int transiently,
        int rmailflag;
        int raideflag;
        int newmailcount = 0;
-       struct visit vbuf;
+       visit vbuf;
        char truncated_roomname[ROOMNAMELEN];
         struct cdbdata *cdbfr;
        long *msglist = NULL;
@@ -1834,7 +1834,7 @@ unsigned CtdlCreateRoom(char *new_room_name,
 
        struct ctdlroom qrbuf;
        struct floor flbuf;
-       struct visit vbuf;
+       visit vbuf;
 
        CtdlLogPrintf(CTDL_DEBUG, "CtdlCreateRoom(name=%s, type=%d, view=%d)\n",
                new_room_name, new_room_type, new_room_view);
index d5755f0a64916fc2feb096dfe16a953662964e7c..f894719b2305fec5cf23778ed7396f5ed1da7bf1 100644 (file)
@@ -212,7 +212,7 @@ enum {
 
 
 /* Defines the relationship of a user to a particular room */
-struct visit {
+typedef struct __visit {
        long v_roomnum;
        long v_roomgen;
        long v_usernum;
@@ -221,7 +221,7 @@ struct visit {
        char v_seen[SIZ];
        char v_answered[SIZ];
        int v_view;
-};
+} visit;
 
 #define V_FORGET       1       /* User has zapped this room        */
 #define V_LOCKOUT      2       /* User is locked out of this room  */
index 6e15afb8f9f3cae5a849c535e441a974ce661dd4..042f211f541b003fb22936d5946e4f0f0cf9c27e 100644 (file)
@@ -269,7 +269,7 @@ int GenerateRelationshipIndex(char *IndexBuf,
 /*
  * Back end for CtdlSetRelationship()
  */
-void put_visit(struct visit *newvisit)
+void put_visit(visit *newvisit)
 {
        char IndexBuf[32];
        int IndexLen = 0;
@@ -283,7 +283,7 @@ void put_visit(struct visit *newvisit)
 
        /* Store the record */
        cdb_store(CDB_VISIT, IndexBuf, IndexLen,
-                 newvisit, sizeof(struct visit)
+                 newvisit, sizeof(visit)
        );
 }
 
@@ -293,7 +293,7 @@ void put_visit(struct visit *newvisit)
 /*
  * Define a relationship between a user and a room
  */
-void CtdlSetRelationship(struct visit *newvisit,
+void CtdlSetRelationship(visit *newvisit,
                         struct ctdluser *rel_user,
                         struct ctdlroom *rel_room)
 {
@@ -312,7 +312,7 @@ void CtdlSetRelationship(struct visit *newvisit,
 /*
  * Locate a relationship between a user and a room
  */
-void CtdlGetRelationship(struct visit *vbuf,
+void CtdlGetRelationship(visit *vbuf,
                         struct ctdluser *rel_user,
                         struct ctdlroom *rel_room)
 {
@@ -328,13 +328,13 @@ void CtdlGetRelationship(struct visit *vbuf,
                                             rel_user->usernum);
 
        /* Clear out the buffer */
-       memset(vbuf, 0, sizeof(struct visit));
+       memset(vbuf, 0, sizeof(visit));
 
        cdbvisit = cdb_fetch(CDB_VISIT, IndexBuf, IndexLen);
        if (cdbvisit != NULL) {
                memcpy(vbuf, cdbvisit->ptr,
-                      ((cdbvisit->len > sizeof(struct visit)) ?
-                       sizeof(struct visit) : cdbvisit->len));
+                      ((cdbvisit->len > sizeof(visit)) ?
+                       sizeof(visit) : cdbvisit->len));
                cdb_free(cdbvisit);
        }
        else {
@@ -1452,8 +1452,8 @@ void cmd_setu(char *new_parms)
 void cmd_slrp(char *new_ptr)
 {
        long newlr;
-       struct visit vbuf;
-       struct visit original_vbuf;
+       visit vbuf;
+       visit original_vbuf;
 
        if (CtdlAccessCheck(ac_logged_in)) {
                return;
@@ -1468,7 +1468,7 @@ void cmd_slrp(char *new_ptr)
        CtdlGetUserLock(&CC->user, CC->curr_user);
 
        CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
-       memcpy(&original_vbuf, &vbuf, sizeof(struct visit));
+       memcpy(&original_vbuf, &vbuf, sizeof(visit));
        vbuf.v_lastseen = newlr;
        snprintf(vbuf.v_seen, sizeof vbuf.v_seen, "*:%ld", newlr);
 
@@ -1525,7 +1525,7 @@ void cmd_gtsn(char *argbuf) {
  */
 int CtdlInvtKick(char *iuser, int op) {
        struct ctdluser USscratch;
-       struct visit vbuf;
+       visit vbuf;
        char bbb[SIZ];
 
        if (CtdlGetUser(&USscratch, iuser) != 0) {
@@ -1601,7 +1601,7 @@ void cmd_kick(char *iuser) {cmd_invt_kick(iuser, 0);}
  * Returns 0 on success
  */
 int CtdlForgetThisRoom(void) {
-       struct visit vbuf;
+       visit vbuf;
 
        /* On some systems, Aides are not allowed to forget rooms */
        if (is_aide() && (config.c_aide_zap == 0)
@@ -1961,7 +1961,7 @@ int InitialMailCheck()
        int a;
        char mailboxname[ROOMNAMELEN];
        struct ctdlroom mailbox;
-       struct visit vbuf;
+       visit vbuf;
        struct cdbdata *cdbfr;
        long *msglist = NULL;
        int num_msgs = 0;
@@ -2000,7 +2000,7 @@ int InitialMailCheck()
  */
 void cmd_view(char *cmdbuf) {
        int requested_view;
-       struct visit vbuf;
+       visit vbuf;
 
        if (CtdlAccessCheck(ac_logged_in)) {
                return;
index 41899ad91dcf0cc75b80737592d371cf3776870a..1dcc07974a985f10bdc91473385e88b81a844ef8 100644 (file)
@@ -31,7 +31,7 @@ void ForEachUser(void (*CallBack)(struct ctdluser *EachUser, void *out_data),
 void ListThisUser(struct ctdluser *usbuf, void *data);
 int NewMailCount(void);
 int InitialMailCheck(void);
-void put_visit(struct visit *newvisit);
+void put_visit(visit *newvisit);
 /* MailboxName is deprecated us CtdlMailboxName instead */
 void MailboxName(char *buf, size_t n, const struct ctdluser *who,
                 const char *prefix) __attribute__ ((deprecated));