-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathannounces.h
69 lines (52 loc) · 2.28 KB
/
announces.h
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
/***************************************************************************
announces.h - board announces support header
-------------------
begin : Mon Feb 24 2003
copyright : (C) 2001 - 2003 by Alexander Bilichenko
email : [email protected]
***************************************************************************/
#ifndef ANNOUNCES_H_INCLUDED
#define ANNOUNCES_H_INCLUDED
#include "basetypes.h"
#include "profiles.h"
#define GLOBAL_ANNOUNCE_MAXSIZE 513
#define ANNOUNCES_RETURN_OK 0
#define ANNOUNCES_RETURN_IO_ERROR 1
#define ANNOUNCES_RETURN_DB_ERROR 2
#define ANNOUNCES_RETURN_LOW_RES 3
#define ANNOUNCES_RETURN_NOT_FOUND 4
#define ANNOUNCES_UPDATE_OPT_USER 0x01
#define ANNOUNCES_UPDATE_OPT_TIME 0x02
#define ANNOUNCES_UPDATE_OPT_FLAGS 0x04
#define ANNOUNCES_UPDATE_OPT_TTL 0x08
#pragma pack(push, 1)
struct SGlobalAnnounce {
char Announce[GLOBAL_ANNOUNCE_MAXSIZE];
char From[PROFILES_MAX_USERNAME_LENGTH];
DWORD UIdFrom; // UniqID of poster
time_t Date; // post date
DWORD TTL; // Time To Live of this announce
DWORD Flags; // flags of the post
DWORD Number; // unique announce number (for identification)
DWORD Reserved[2]; // reserved for the future use
};
static_assert(sizeof(SGlobalAnnounce) == 571, "sizeof(SGlobalAnnounce) must be 571 (0x23B)");
#pragma pack(pop)
/* Post announce as selected user.
* It don't check security permitions of poster !
*/
int PostGlobalAnnounce(const char *username, DWORD uniqid, const char *announce, DWORD ttl, DWORD flags);
/* Read annonces that implies to 'ct' date. (!!! ignored for now !!!)
*/
int ReadGlobalAnnounces(SGlobalAnnounce **ga, DWORD *cnt);
/* Delete global announce by id
*/
int DeleteGlobalAnnounce(DWORD id, DWORD uniqid);
/* Read last used announce number
*/
int ReadLastAnnounceNumber(DWORD *an);
/* Update announce (using updateopt flags) by id
*/
int UpdateGlobalAnnounce(DWORD id, const char *username, DWORD uniqid, const char *announce,
DWORD ttl, DWORD flags, DWORD updateopt);
#endif // of ANNOUNCES_H_INCLUDED