Mailing list header changes (fuck you Google)
[citadel.git] / webcit / roomops.h
1 /*
2  * Copyright (c) 1996-2013 by the citadel.org team
3  *
4  * This program is open source software.  You can redistribute it and/or
5  * modify it under the terms of the GNU General Public License, version 3.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13
14 #define VIRTUAL_MY_FLOOR -1
15
16 /*
17  * This struct holds a list of rooms for "Goto" operations.
18  */
19 struct march {
20         struct march *next;       /* pointer to next in linked list */
21         char march_name[128];     /* name of room */
22         int march_floor;          /* floor number of room */
23         int march_order;          /* sequence in which we are to visit this room */
24 };
25
26 /*
27  * This struct holds a list of rooms for client display. It is a binary tree.
28  */
29 struct roomlisting {
30         struct roomlisting *lnext;      /* pointer to 'left' tree node */
31         struct roomlisting *rnext;      /* pointer to 'right' tree node */
32         char rlname[128];               /* name of room */
33         unsigned rlflags;               /* room flags */
34         int rlfloor;                    /* the floor it resides on */
35         int rlorder;                    /* room listing order */
36 };
37
38
39
40
41
42 typedef struct _floor {
43         int ID;
44         StrBuf *Name;
45         long NRooms;
46         long AlphaN;
47 } Floor;
48
49 /*
50  * Data structure for roomlist-to-folderlist conversion 
51  */
52 struct __ofolder {
53         int floor;      /* which floor is it on */
54         char room[SIZ]; /* which roomname ??? */
55         char name[SIZ]; /* which is its own name??? */
56         int hasnewmsgs; /* are there unread messages inside */
57         int is_mailbox; /* is it a mailbox?  */
58         int selectable; /* can we select it ??? */
59         int view;       /* whats its default view? inbox/calendar.... */
60         int num_rooms;  /* If this is a floor, how many rooms does it have */
61 };
62
63
64
65 /*
66  * Data structure for roomlist-to-folderlist conversion 
67  */
68 typedef struct _folder {
69         /* Data citserver tells us about the room */
70         long QRFlags;    /* roomflags */
71         long QRFlags2;    /* Bitbucket NO2 */
72         long RAFlags;
73
74         int view;       /* whats its default view? inbox/calendar.... */
75         long defview;
76         long lastchange; /* todo... */
77
78         /* later evaluated data from the serverdata */
79         StrBuf *name;   /* the full name of the room we're talking about */
80         long nRoomNameParts;
81         StrBuf **RoomNameParts;
82
83         int floorid;      /* which floor is it on */
84         const Floor *Floor;   /* point to the floor we're on.. */
85
86         int hasnewmsgs; /* are there unread messages inside */
87         int is_inbox;   /* is it a mailbox?  */
88
89         int RoomAideLoaded;
90         StrBuf *RoomAide;
91
92 /* only available if GNET contains this */
93         const StrBuf* RoomAlias; /* by what mail will this room send mail? */
94
95 /* only available if GETR was run */
96         int XALoaded;
97         StrBuf *XAPass;
98         StrBuf *Directory;
99         long Order;
100
101 /* Only available from the GOTO context... */
102         long nNewMessages;
103         long nTotalMessages;
104         long LastMessageRead;
105         long HighestRead;
106         int ShowInfo;
107         int UsersNewMAilboxMessages; /* should we notify the user about new messages? */
108         int IsTrash;
109 /* Only available if certain other commands ran */
110         int XHaveRoomPic;
111         int XHaveRoomPicLoaded;
112
113         int XHaveInfoTextLoaded;
114         StrBuf *XInfoText;
115
116         int XHaveDownloadCount;
117         int XDownloadCount;
118         
119         int BumpUsers; /* if SETR set to 1 to make all users who knew this room to forget about it. */
120
121         HashList *IgnetCfgs[maxRoomNetCfg + 1];
122 } folder;
123
124 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP);
125 void vDeleteFolder(void *vFolder);
126 void FlushFolder(folder *room);
127 void FlushIgnetCfgs(folder *room);
128 void ParseGoto(folder *proom, StrBuf *Line);
129 void FlushRoomlist(void); /* release our caches, so a deleted / zapped room disapears */
130 void ReloadCurrentRoom(void); /* Flush cache; reload current state */
131
132 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP);
133 HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP);
134 int SortRoomsByListOrder(const void *room1, const void *room2);
135 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP);
136
137
138 void LoadRoomAide(void);
139 void LoadRoomXA (void);
140 void LoadXRoomPic(void);
141 void LoadXRoomInfoText(void);
142 void LoadXRoomXCountFiles(void);
143
144 long gotoroom(const StrBuf *gname);
145
146 void slrp_highest(void);
147 void remove_march(const StrBuf *aaa);
148 void dotskip(void);
149 void smart_goto(const StrBuf *next_room);
150 void free_march_list(wcsession *wcf);
151
152 /*
153  * wrapper around usual sort-comparator; private rooms will allways be prefered, -1 if one of them NULL
154  */
155 int CompareRooms(const folder *room1, const folder *room2);
156
157
158 #define REST_TOPLEVEL 0
159 #define REST_IN_NAMESPACE (1<<0)
160 #define REST_IN_FLOOR (1<<1)
161 #define REST_IN_ROOM (1<<2)
162 #define REST_HAVE_SUB_ROOMS (1<<3)
163 #define REST_GOT_LOCAL_PART (1<<4)
164 #define REST_NONEXIST (1<<5)
165
166
167 extern CtxType CTX_ROOMS;
168 extern CtxType CTX_FLOORS;