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