File: nickserv.h

package info (click to toggle)
hybserv 1.9.2-4.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,852 kB
  • ctags: 1,854
  • sloc: ansic: 37,037; sh: 3,178; makefile: 337
file content (166 lines) | stat: -rw-r--r-- 5,998 bytes parent folder | download | duplicates (4)
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
/*
 * nickserv.h
 * Hybserv2 Services by Hybserv2 team
 *
 * $Id: nickserv.h 1398 2006-02-21 09:37:00Z kreator $
 */

#ifndef INCLUDED_nickserv_h
#define INCLUDED_nickserv_h

#include "stdinc.h"
#include "config.h"
#include "client.h"
#include "hash.h"

#ifdef NICKSERVICES

/* NickServ flags */
#define NS_IDENTIFIED   0x00000001 /* nick has IDENTIFY'd */
#define NS_PROTECTED    0x00000002 /* kill to regain nick */
#define NS_NOEXPIRE     0x00000004 /* nickname which doesn't expire */
#define NS_AUTOMASK     0x00000008 /* auto-add new hostmasks */
#define NS_PRIVATE      0x00000010 /* nick won't show up in a LIST */
#define NS_COLLIDE      0x00000020 /* stole a nick - kill them */
#define NS_RELEASE      0x00000040 /* to release an enforced nick */
#define NS_FORBID       0x00000080 /* nick is forbidden */
#define NS_SECURE       0x00000100 /* nick is secure */
#define NS_DELETE       0x00000200 /* delete after a RELOAD */
#define NS_UNSECURE     0x00000400 /* don't need to IDENTIFY */
#define NS_MEMOSIGNON   0x00000800 /* tell about memos on signon */
#define NS_MEMONOTIFY   0x00001000 /* tell about new memos */
#define NS_MEMOS        0x00002000 /* allow others to send memos */
#define NS_HIDEALL      0x00004000 /* hide everything from INFO */
#define NS_HIDEEMAIL    0x00008000 /* hide email from INFO */
#define NS_HIDEURL      0x00010000 /* hide url from INFO */
#define NS_HIDEQUIT     0x00020000 /* hide quitmsg from INFO */
#define NS_HIDEADDR     0x00040000 /* hide last addy from INFO */
#define NS_KILLIMMED    0x00080000 /* kill immediately to regain nick */
#define NS_NOREGISTER   0x00100000 /* cannot register channels */
#define NS_NOCHANOPS    0x00200000 /* not allowed to be opped */
#define NS_NUMERIC      0x00400000 /* ignores 432 numeric */
#define NS_PRIVMSG      0x00800000 /* PRIVMSG or NOTICE */
#define NS_HIDEHOST     0x01000000 /* hide userhost */

/* these are yet to be coded, probably as separate set of flags */
#if 0
# define NS_NOHALFOPS    0x01000000 /* can't halfop */
# define NS_NOVOICE      0x02000000 /* can't +v */
# define NS_NOACCESS     0x04000000 /* can't get access to chans */
# define NS_NOLINK       0x08000000 /* can't link nicknames */
#endif

#define NS_NEVEROP     0x10000000 /* Never op/hop/voice user on join */

struct ChanInfo;
struct ChanAccess;

struct NickHost
{
	struct NickHost *next;
	char *hostmask; /* hostmask for nickname */
};

#ifdef CHANNELSERVICES

/* Each nickname has a list of pointers to channels they have
 * access on */
struct AccessChannel
{
	struct AccessChannel *next, *prev;
	struct ChanInfo *cptr;        /* pointer to channel */
	struct ChanAccess *accessptr; /* pointer to ChanAccess structure on cptr */
};

#endif /* CHANNELSERVICES */

/* structure for registered nicknames */
struct NickInfo
{
	struct NickInfo *next, *prev;
	char *nick;                /* registered nickname */
	char *password;            /* password */
	char *phrase;              /* password recovery phrase */
	struct NickHost *hosts;    /* recognized hosts for this nick */
	time_t created;            /* timestamp when it was registered */
	time_t lastseen;           /* for expiration purposes */
	long flags;                /* nick flags */
	char *email;               /* email address */
	char *url;                 /* url */
	char *gsm;                 /* GSM number */
	char *phone;               /* Phone */
	char *UIN;                 /* ICQ UIN */
	char *lastu;               /* last seen username */
	char *lasth;               /* last seen hostname */
	char *lastqmsg;            /* last quit message */
	char *forbidby;            /* who forbidded the nickname */
	char *forbidreason;        /* why was it forbidden [optional] */
	time_t collide_ts;         /* TS of when to collide them */

#ifdef RECORD_SPLIT_TS
	/* If they split, record their TS, so if they rejoin, we can
	 * check if their TS's match up and don't make them re-IDENTIFY */
	time_t split_ts;
	time_t whensplit;          /* for expiration purposes */
#endif /* RECORD_SPLIT_TS */

#ifdef RECORD_RESTART_TS
	/* Record TS of nicks so that when services are restarted
	 * they won't have to reidentify */
	time_t nick_ts;
#endif

#ifdef LINKED_NICKNAMES
	/* Pointer to next nick in the nickname link list */
	struct NickInfo *nextlink;

	/* If this is the "hub" nickname for a list of linked nicknames,
	 * master will be NULL. If this nickname is a leaf, master will
	 * point to the "hub" nickname of this list */
	struct NickInfo *master;

	/* Number of links in the list this nickname is a part of.
	 * This is only non-zero if this nickname is a master */
	int numlinks;
#endif /* LINKED_NICKNAMES */

#ifdef CHANNELSERVICES
	/* List of channels for which this nickname is a founder */
	struct aChannelPtr *FounderChannels;
	int fccnt; /* number of channels registered */

	/* List of channels this nickname has access on */
	struct AccessChannel *AccessChannels;
	int accnt; /* number of channels they have access to */
#endif /* CHANNELSERVICES */
};

void ns_process(const char *, char *);
int CheckNick(char *);
void CheckOper(struct Luser *);
void ExpireNicknames(time_t);
void AddFounderChannelToNick(struct NickInfo **, struct ChanInfo *);
void RemoveFounderChannelFromNick(struct NickInfo **, struct ChanInfo *);
struct AccessChannel *AddAccessChannel(struct NickInfo *, struct ChanInfo
			                                       *, struct ChanAccess *);
void DeleteAccessChannel(struct NickInfo *, struct AccessChannel *);
struct NickInfo *FindNick(char *);
struct NickInfo *GetLink(char *);
void DelNick(struct NickInfo *);
void DeleteNick(struct NickInfo *);
int HasFlag(char *, int);
void collide(char *);
void release(char *);
void CollisionCheck(time_t);

#ifdef LINKED_NICKNAMES
int IsLinked(struct NickInfo *, struct NickInfo *);
#endif /* LINKED_NICKNAMES */

struct NickInfo *GetMaster(struct NickInfo *);

extern struct NickInfo *nicklist[NICKLIST_MAX];

#endif /* NICKSERVICES */

#endif /* INCLUDED_nickserv_h */