File: roomops.h

package info (click to toggle)
webcit 917-dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 9,164 kB
  • sloc: ansic: 34,213; sh: 4,455; makefile: 346; xml: 91; sed: 9
file content (168 lines) | stat: -rw-r--r-- 4,760 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
 * Copyright (c) 1996-2013 by the citadel.org team
 *
 * This program is open source software.  You can redistribute it and/or
 * modify it under the terms of the GNU General Public License, version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */


#define VIRTUAL_MY_FLOOR -1

/*
 * This struct holds a list of rooms for "Goto" operations.
 */
struct march {
	struct march *next;       /* pointer to next in linked list */
	char march_name[128];     /* name of room */
	int march_floor;          /* floor number of room */
	int march_order;          /* sequence in which we are to visit this room */
};

/*
 * This struct holds a list of rooms for client display. It is a binary tree.
 */
struct roomlisting {
	struct roomlisting *lnext;	/* pointer to 'left' tree node */
	struct roomlisting *rnext;	/* pointer to 'right' tree node */
	char rlname[128];		/* name of room */
	unsigned rlflags;		/* room flags */
	int rlfloor;			/* the floor it resides on */
	int rlorder;			/* room listing order */
};





typedef struct _floor {
	int ID;
	StrBuf *Name;
	long NRooms;
	long AlphaN;
} Floor;

/*
 * Data structure for roomlist-to-folderlist conversion 
 */
struct __ofolder {
	int floor;      /* which floor is it on */
	char room[SIZ];	/* which roomname ??? */
	char name[SIZ];	/* which is its own name??? */
	int hasnewmsgs;	/* are there unread messages inside */
	int is_mailbox;	/* is it a mailbox?  */
	int selectable;	/* can we select it ??? */
	int view;       /* whats its default view? inbox/calendar.... */
	int num_rooms;	/* If this is a floor, how many rooms does it have */
};



/*
 * Data structure for roomlist-to-folderlist conversion 
 */
typedef struct _folder {
	/* Data citserver tells us about the room */
	long QRFlags;    /* roomflags */
	long QRFlags2;    /* Bitbucket NO2 */
	long RAFlags;

	int view;       /* whats its default view? inbox/calendar.... */
	long defview;
	long lastchange; /* todo... */

	/* later evaluated data from the serverdata */
	StrBuf *name;	/* the full name of the room we're talking about */
	long nRoomNameParts;
	StrBuf **RoomNameParts;

	int floorid;      /* which floor is it on */
	const Floor *Floor;   /* point to the floor we're on.. */

	int hasnewmsgs;	/* are there unread messages inside */
	int is_inbox;	/* is it a mailbox?  */

	int RoomAideLoaded;
	StrBuf *RoomAide;

/* only available if GNET contains this */
	const StrBuf* RoomAlias; /* by what mail will this room send mail? */

/* only available if GETR was run */
	int XALoaded;
	StrBuf *XAPass;
	StrBuf *Directory;
	long Order;

/* Only available from the GOTO context... */
	long nNewMessages;
	long nTotalMessages;
	long LastMessageRead;
	long HighestRead;
	int ShowInfo;
	int UsersNewMAilboxMessages; /* should we notify the user about new messages? */
	int IsTrash;
/* Only available if certain other commands ran */
	int XHaveRoomPic;
	int XHaveRoomPicLoaded;

	int XHaveInfoTextLoaded;
	StrBuf *XInfoText;

	int XHaveDownloadCount;
	int XDownloadCount;
	
	int BumpUsers; /* if SETR set to 1 to make all users who knew this room to forget about it. */

	HashList *IgnetCfgs[maxRoomNetCfg + 1];
} folder;

HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP);
void vDeleteFolder(void *vFolder);
void FlushFolder(folder *room);
void FlushIgnetCfgs(folder *room);
void ParseGoto(folder *proom, StrBuf *Line);
void FlushRoomlist(void); /* release our caches, so a deleted / zapped room disapears */
void ReloadCurrentRoom(void); /* Flush cache; reload current state */

HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP);
HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP);
int SortRoomsByListOrder(const void *room1, const void *room2);
void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP);


void LoadRoomAide(void);
void LoadRoomXA (void);
void LoadXRoomPic(void);
void LoadXRoomInfoText(void);
void LoadXRoomXCountFiles(void);

long gotoroom(const StrBuf *gname);

void slrp_highest(void);
void remove_march(const StrBuf *aaa);
void dotskip(void);
void smart_goto(const StrBuf *next_room);
void free_march_list(wcsession *wcf);

/*
 * wrapper around usual sort-comparator; private rooms will allways be prefered, -1 if one of them NULL
 */
int CompareRooms(const folder *room1, const folder *room2);


#define REST_TOPLEVEL 0
#define REST_IN_NAMESPACE (1<<0)
#define REST_IN_FLOOR (1<<1)
#define REST_IN_ROOM (1<<2)
#define REST_HAVE_SUB_ROOMS (1<<3)
#define REST_GOT_LOCAL_PART (1<<4)
#define REST_NONEXIST (1<<5)


extern CtxType CTX_ROOMS;
extern CtxType CTX_FLOORS;