d64cf1f0418374a9c2eb9476492555c6ee4b0058
[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 GETR was run */
82         int XALoaded;
83         StrBuf *XAPass;
84         StrBuf *Directory;
85         long Order;
86
87 /* Only available from the GOTO context... */
88         long nNewMessages;
89         long nTotalMessages;
90         long LastMessageRead;
91         long HighestRead;
92         int ShowInfo;
93         int UsersNewMAilboxMessages; /* should we notify the user about new messages? */
94         int IsTrash;
95 /* Only available if certain other commands ran */
96         int XHaveRoomPic;
97         int XHaveRoomPicLoaded;
98
99         int XHaveInfoTextLoaded;
100         StrBuf *XInfoText;
101
102         int XHaveDownloadCount;
103         int XDownloadCount;
104         
105         int BumpUsers; /* if SETR set to 1 to make all users who knew this room to forget about it. */
106
107         HashList *IgnetCfgs[maxRoomNetCfg + 1];
108 }folder;
109
110 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP);
111 void vDeleteFolder(void *vFolder);
112 void FlushFolder(folder *room);
113 void FlushIgnetCfgs(folder *room);
114 void ParseGoto(folder *proom, StrBuf *Line);
115 void FlushRoomlist(void); /* release our caches, so a deleted / zapped room disapears */
116 void ReloadCurrentRoom(void); /* Flush cache; reload current state */
117
118 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP);
119 HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP);
120 int SortRoomsByListOrder(const void *room1, const void *room2);
121 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP);
122
123
124 void LoadRoomAide(void);
125 void LoadRoomXA (void);
126 void LoadXRoomPic(void);
127 void LoadXRoomInfoText(void);
128 void LoadXRoomXCountFiles(void);
129
130 long gotoroom(const StrBuf *gname);
131
132 void slrp_highest(void);
133 void remove_march(const StrBuf *aaa);
134 void dotskip(void);
135 void smart_goto(const StrBuf *next_room);
136 void free_march_list(wcsession *wcf);
137
138 /*
139  * wrapper around usual sort-comparator; private rooms will allways be prefered, -1 if one of them NULL
140  */
141 int CompareRooms(const folder *room1, const folder *room2);
142
143
144 #define REST_TOPLEVEL 0
145 #define REST_IN_NAMESPACE (1<<0)
146 #define REST_IN_FLOOR (1<<1)
147 #define REST_IN_ROOM (1<<2)
148 #define REST_HAVE_SUB_ROOMS (1<<3)
149 #define REST_GOT_LOCAL_PART (1<<4)
150 #define REST_NONEXIST (1<<5)
151
152
153 extern CtxType CTX_ROOMS;
154 extern CtxType CTX_FLOORS;